Codeigniter – How to echo page number with codeigniter pagination library

codeigniterechonumberspagination

I am using the codeigniter pagination library to page my search results. I am using a limit and an offset to generate the results.

I would like to know how, apart from in the pagination links, echo the number of the page the user is currently viewing.

For example;

You are currently viewing page X out of Y results.

How is this possible??

Best Answer

This also gives the current page no

$currentPage = floor(($this->uri->segment(n)/$config['per_page']) + 1);   

where n is the segment

echo "Current Page:".$currentPage;