php – codeigniter pagination: create links-ThrowExceptions

Exception or error:

I have this piece of code, which uses Codeigniter’s native Pagination Class.

            $config['base_url'] = base_url().'notification/display_notification_info/'.$notification_id;
            $config['total_rows'] = $totalRows;
            $config['per_page'] = $per_page;
            echo $this->pagination->create_links();

It shows the last page by default. So, the links are displayed like so:

< 1, 2, 3

It doesn’t show the last page’s URL.
It should be:


Where is my mistake?

How to solve:

If your actual page is your last page by default, then it will not show a URL.
But you can still to force it url to current page


is the url correctly formed (’.$notification_id)?
don’t use base_url()..use site_url()
try it

$config['base_url'] = site_url('notification/display_notification_info/'.$notification_id);

Leave a Reply

Your email address will not be published. Required fields are marked *