You can clone with
In the built-in pagination class (libraries/Pagination.php) the variable $uri_segment is hard coded to a value of 3. This is normally the segment of the uri that contains the current page (so the links can format properly), but if you set a base_url with more than 2 segments the links created no longer function correctly.
Example (works as expected):
$config['base_url'] = site_url('controller/function');
This produces the links which correctly highlight the current page, move correctly from previous to next, etc, since the uri_segment for 3 would be the generated page number. (controller/function/[page inserted by pagination]). If you add on another segment to the base_url, however, the uri_segment is no longer 3, but some larger value.
$config['base_url'] = site_url('controller/function/param1');
The current page is at a uri_segment of 4 now, not 3. So if you click on page 2, for example, it correctly generates the link (controller/function/param1/[page inserted by pagination], but the current page is no longer displayed correctly. This limitation forces any function using pagination to not have any parameters when enable_query_strings is not set, which is annoying.
Simple fix which worked for me, but probably would not for all cases:
$this->uri_segment = count(explode("/", $CI->uri->uri_string())); // assumes no trailing slash
After adding this line the links correctly pulled the current page.
I've encountered this too. I'll work on a fix later today.
The default is set to 3, but I don't see what is the problem, as you can change it... Please, read the user guide (quote):
The following is a list of all the preferences you can pass to the initialization function to tailor the display.
$config['uri_segment'] = 3;
The pagination function automatically determines which segment of your URI contains the page number. If you need something different you can specify it.
Fix issues #1476, #1909
See the above commit.