From what I saw, CodeIgniter's pagination is counting the page wrong way, because I got pagination looking like this:
1 2 3 >
And its good, the problem is in the each pagination number url, except the first one:
Number 2 from the pagination has the following url:
http://my-url.com/index.php/page/1
And number 3 has the following url:
http://my-url.com/index.php/page/2
So, the number is URL is decreased by 1 everytime.
How can I solve that, so the page numbers in urls will be the same as the page numbers in the pagination?
My pagination config:
$config['per_page'] = 5;
$config['base_url'] = site_url('page');
$config['uri_segment'] = 2;
$page = $this->uri->segment(2);
$total_rows_array = $this->records->get($config['per_page'], $page * $config['per_page']); // parameters: limit, offset.
$config['total_rows'] = count($total_rows_array);
Had the same problem you have, and I added this configuration line:
$config['use_page_numbers'] = TRUE;
and it works like a charm!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With