CodeIgniter Pagination – Bug suffix in first paging

when you use suffix in paging codeigniter, example to pass $_GET parameter


you will find first or no 1 page not include your suffix


the problem in core, you must patch it self


line 231 – first link

$output .= $this->first_tag_open.'<a '.$this->anchor_class.'href="'.$first_url.'">'.$this->first_link.'</a>'.$this->first_tag_close;


$output .= $this->first_tag_open.'<a '.$this->anchor_class.'href="'.$first_url.$this->suffix.'">'.$this->first_link.'</a>'.$this->first_tag_close;

line 285 – 1 link

$output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$loop.'</a>'.$this->num_tag_close;


$output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.$this->suffix.'">'.$loop.'</a>'.$this->num_tag_close;

add $this->suffix variable after $this->first_url value


i think you must not ‘hack’ the $this->first_url value to concat with $this->suffix,  it will ruined the ‘if’ decision in line above



Published by


just to remember what i had known :)

3 thoughts on “CodeIgniter Pagination – Bug suffix in first paging”

  1. I fixed it differently. My first page is going to line 289 instead of 285. I changed this:

    $n = ($n == ”) ? ” : $this->prefix.$n.$this->suffix;

    for this:

    $n = ($n == ”) ? $this->prefix.$this->suffix : $this->prefix.$n.$this->suffix;

    Hope it helps.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s