I was trying to work with the codeigniter pagination class.
Here is my code
$this->load->library('pagination');
$config['base_url'] = base_url('language/'.$this->uri->segment(2));
$config['total_rows'] = $page_count;
$config['per_page'] = 1;
$config['num_links'] = '2';
$config['uri_segment'] = '2';
$this->pagination->initialize($config);
$data['pages'] = $this->pagination->create_links();
but then, in the first page, the url would be look like
localhost/language/something/
while the second page would be
localhost/language/something/1
which looks kinda weird, is it possible to have the url starts with 1 on first page?
Here is the code to override the built in pagination class. Place it in application/libraries and just do everything else like normal.
I’ve added a comment to each line I edited from the original class.
NOTE: in your sample code you put total pages in the total_rows config value. Be sure to put the total number of records, not the total number of pages.