title: Pagination current link not highlighting
body: <p>I got a strange problem, my current pagination link is not highlighted the pagination urls I made looks like:</p>
  
  <pre><code>site.com/list/50/?some=value
  </code></pre>
  
  <p>Everything is working great, but the current pagination link in view is not highlighted. I checked CSS and it's ok, the problem comes from the library I guess.</p>
  
  <p>This is my code. I can't see anything wrong in here:</p>
  
  <pre><code>$pagination['base_url'] = site_url('asd');
      if($_SERVER['QUERY_STRING'] !==''){
      $pagination['suffix'] = '/?'.$_SERVER['QUERY_STRING'];
      }
      $pagination['first_url'] = site_url('asd');
      $pagination['total_rows'] = $total_rows[0]-&gt;total;
      $pagination['first_link'] = '&amp;nbsp;First&amp;nbsp;';
      $pagination['last_link'] = '&amp;nbsp;Last&amp;nbsp;';
      $pagination['next_link']  = '&amp;nbsp;Next&amp;nbsp;';
      $pagination['prev_link']  = '&amp;nbsp;Prev&amp;nbsp;';
      $pagination['num_links'] = 5;
  
      $this-&gt;pagination-&gt;initialize($pagination);
  </code></pre>
  
  <p>Any clue appreciated.</p>
  
  <p>i post my library which i edited for markup also:</p>
  
  <pre><code>&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  /**
   * CodeIgniter
   *
   * An open source application development framework for PHP 5.1.6 or newer
   *
   * @package     CodeIgniter
   * @author      ExpressionEngine Dev Team
   * @copyright   Copyright (c) 2008 - 2011, EllisLab, Inc.
   * @license     http://codeigniter.com/user_guide/license.html
   * @link        http://codeigniter.com
   * @since       Version 1.0
   * @filesource
   */
  
  // ------------------------------------------------------------------------
  
  /**
   * Pagination Class
   *
   * @package     CodeIgniter
   * @subpackage  Libraries
   * @category    Pagination
   * @author      ExpressionEngine Dev Team
   * @link        http://codeigniter.com/user_guide/libraries/pagination.html
   */
  class CI_Pagination {
  
      var $base_url           = ''; // The page we are linking to
      var $prefix         = ''; // A custom prefix added to the path.
      var $suffix         = ''; // A custom suffix added to the path.
  
      var $total_rows         = ''; // Total number of items (database results)
      var $per_page           = 10; // Max number of items you want shown per page
      var $num_links          =  2; // Number of "digit" links to show before/after the currently viewed page
      var $cur_page           =  0; // The current page being viewed
      var $first_link         = '&amp;lsaquo; First';
      var $next_link          = '&amp;gt;';
      var $prev_link          = '&amp;lt;';
      var $last_link          = 'Last &amp;rsaquo;';
      var $uri_segment        = 3;
      var $full_tag_open      = '&lt;p class="CI-pagination"&gt;';
      var $full_tag_close     = '&lt;/p&gt;';
      var $first_tag_open     = '&lt;span class="pagination-first"&gt;';
      var $first_tag_close            = '&amp;nbsp;&lt;/span&gt;';
      var $last_tag_open      = '&lt;span class="pagination-last"&gt;&amp;nbsp;';
      var $last_tag_close     = '&lt;/span&gt;';
      var $first_url          = ''; // Alternative URL for the First Page.
      var $cur_tag_open       = '&lt;span class="pagination-current"&gt;&amp;nbsp;&lt;a href="javascript:void(0)" class="btn btn-small"&gt;';
      var $cur_tag_close      = '&lt;/a&gt;&lt;/span&gt;';
      var $next_tag_open      = '&lt;span class="pagination-next"&gt;&amp;nbsp;';
      var $next_tag_close     = '&amp;nbsp;&lt;/span&gt;';
      var $prev_tag_open      = '&lt;span class="pagination-prev"&gt;&amp;nbsp;';
      var $prev_tag_close     = '&lt;/span&gt;';
      var $num_tag_open       = '&lt;span class="pagination-num"&gt;&amp;nbsp;';
      var $num_tag_close      = '&lt;/span&gt;';
      var $page_query_string          = FALSE;
      var $query_string_segment       = 'per_page';
      var $display_pages      = TRUE;
      var $anchor_class       = 'btn btn-small';
  
      /**
       * Constructor
       *
       * @access  public
       * @param   array   initialization parameters
       */
      public function __construct($params = array())
      {
          if (count($params) &gt; 0)
          {
              $this-&gt;initialize($params);
          }
  
          if ($this-&gt;anchor_class != '')
          {
              $this-&gt;anchor_class = 'class="'.$this-&gt;anchor_class.'" ';
          }
  
          log_message('debug', "Pagination Class Initialized");
      }
  
      // --------------------------------------------------------------------
  
      /**
       * Initialize Preferences
       *
       * @access  public
       * @param   array   initialization parameters
       * @return  void
       */
      function initialize($params = array())
      {
          if (count($params) &gt; 0)
          {
              foreach ($params as $key =&gt; $val)
              {
                  if (isset($this-&gt;$key))
                  {
                      $this-&gt;$key = $val;
                  }
              }
          }
      }
  
      // --------------------------------------------------------------------
  
      /**
       * Generate the pagination links
       *
       * @access  public
       * @return  string
       */
      function create_links()
      {
          // If our item count or per-page total is zero there is no need to continue.
          if ($this-&gt;total_rows == 0 OR $this-&gt;per_page == 0)
          {
              return '';
          }
  
          // Calculate the total number of pages
          $num_pages = ceil($this-&gt;total_rows / $this-&gt;per_page);
  
          // Is there only one page? Hm... nothing more to do here then.
          if ($num_pages == 1)
          {
              return '';
          }
  
          // Determine the current page number.
          $CI =&amp; get_instance();
  
          if ($CI-&gt;config-&gt;item('enable_query_strings') === TRUE OR $this-&gt;page_query_string === TRUE)
          {
              if ($CI-&gt;input-&gt;get($this-&gt;query_string_segment) != 0)
              {
                  $this-&gt;cur_page = $CI-&gt;input-&gt;get($this-&gt;query_string_segment);
  
                  // Prep the current page - no funny business!
                  $this-&gt;cur_page = (int) $this-&gt;cur_page;
              }
          }
          else
          {
              if ($CI-&gt;uri-&gt;segment($this-&gt;uri_segment) != 0)
              {
                  $this-&gt;cur_page = $CI-&gt;uri-&gt;segment($this-&gt;uri_segment);
  
                  // Prep the current page - no funny business!
                  $this-&gt;cur_page = (int) $this-&gt;cur_page;
              }
          }
  
          $this-&gt;num_links = (int)$this-&gt;num_links;
  
          if ($this-&gt;num_links &lt; 1)
          {
              show_error('Your number of links must be a positive number.');
          }
  
          if ( ! is_numeric($this-&gt;cur_page))
          {
              $this-&gt;cur_page = 0;
          }
  
          // Is the page number beyond the result range?
          // If so we show the last page
          if ($this-&gt;cur_page &gt; $this-&gt;total_rows)
          {
              $this-&gt;cur_page = ($num_pages - 1) * $this-&gt;per_page;
          }
  
          $uri_page_number = $this-&gt;cur_page;
          $this-&gt;cur_page = floor(($this-&gt;cur_page/$this-&gt;per_page) + 1);
  
          // Calculate the start and end numbers. These determine
          // which number to start and end the digit links with
          $start = (($this-&gt;cur_page - $this-&gt;num_links) &gt; 0) ? $this-&gt;cur_page - ($this-&gt;num_links - 1) : 1;
          $end   = (($this-&gt;cur_page + $this-&gt;num_links) &lt; $num_pages) ? $this-&gt;cur_page + $this-&gt;num_links : $num_pages;
  
          // Is pagination being used over GET or POST?  If get, add a per_page query
          // string. If post, add a trailing slash to the base URL if needed
          if ($CI-&gt;config-&gt;item('enable_query_strings') === TRUE OR $this-&gt;page_query_string === TRUE)
          {
              $this-&gt;base_url = rtrim($this-&gt;base_url).'&amp;amp;'.$this-&gt;query_string_segment.'=';
          }
          else
          {
              $this-&gt;base_url = rtrim($this-&gt;base_url, '/') .'/';
          }
  
          // And here we go...
          $output = '';
  
          // Render the "First" link
          if  ($this-&gt;first_link !== FALSE AND $this-&gt;cur_page &gt; ($this-&gt;num_links + 1))
          {
              $first_url = ($this-&gt;first_url == '') ? $this-&gt;base_url : $this-&gt;first_url;
              $output .= $this-&gt;first_tag_open.'&lt;a '.$this-&gt;anchor_class.'href="'.$first_url.'"&gt;'.$this-&gt;first_link.'&lt;/a&gt;'.$this-&gt;first_tag_close;
          }
  
          // Render the "previous" link
          if  ($this-&gt;prev_link !== FALSE AND $this-&gt;cur_page != 1)
          {
              $i = $uri_page_number - $this-&gt;per_page;
  
              if ($i == 0 &amp;&amp; $this-&gt;first_url != '')
              {
                  $output .= $this-&gt;prev_tag_open.'&lt;a '.$this-&gt;anchor_class.'href="'.$this-&gt;first_url.'"&gt;'.$this-&gt;prev_link.'&lt;/a&gt;'.$this-&gt;prev_tag_close;
              }
              else
              {
                  $i = ($i == 0) ? '' : $this-&gt;prefix.$i.$this-&gt;suffix;
                  $output .= $this-&gt;prev_tag_open.'&lt;a '.$this-&gt;anchor_class.'href="'.$this-&gt;base_url.$i.'"&gt;'.$this-&gt;prev_link.'&lt;/a&gt;'.$this-&gt;prev_tag_close;
              }
  
          }
  
          // Render the pages
          if ($this-&gt;display_pages !== FALSE)
          {
              // Write the digit links
              for ($loop = $start -1; $loop &lt;= $end; $loop++)
              {
                  $i = ($loop * $this-&gt;per_page) - $this-&gt;per_page;
  
                  if ($i &gt;= 0)
                  {
                      if ($this-&gt;cur_page == $loop)
                      {
                          $output .= $this-&gt;cur_tag_open.$loop.$this-&gt;cur_tag_close; // Current page
                      }
                      else
                      {
                          $n = ($i == 0) ? '' : $i;
  
                          if ($n == '' &amp;&amp; $this-&gt;first_url != '')
                          {
                              $output .= $this-&gt;num_tag_open.'&lt;a '.$this-&gt;anchor_class.'href="'.$this-&gt;first_url.'"&gt;'.$loop.'&lt;/a&gt;'.$this-&gt;num_tag_close;
                          }
                          else
                          {
                              $n = ($n == '') ? '' : $this-&gt;prefix.$n.$this-&gt;suffix;
  
                              $output .= $this-&gt;num_tag_open.'&lt;a '.$this-&gt;anchor_class.'href="'.$this-&gt;base_url.$n.'"&gt;'.$loop.'&lt;/a&gt;'.$this-&gt;num_tag_close;
                          }
                      }
                  }
              }
          }
  
          // Render the "next" link
          if ($this-&gt;next_link !== FALSE AND $this-&gt;cur_page &lt; $num_pages)
          {
              $output .= $this-&gt;next_tag_open.'&lt;a '.$this-&gt;anchor_class.'href="'.$this-&gt;base_url.$this-&gt;prefix.($this-&gt;cur_page * $this-&gt;per_page).$this-&gt;suffix.'"&gt;'.$this-&gt;next_link.'&lt;/a&gt;'.$this-&gt;next_tag_close;
          }
  
          // Render the "Last" link
          if ($this-&gt;last_link !== FALSE AND ($this-&gt;cur_page + $this-&gt;num_links) &lt; $num_pages)
          {
              $i = (($num_pages * $this-&gt;per_page) - $this-&gt;per_page);
              $output .= $this-&gt;last_tag_open.'&lt;a '.$this-&gt;anchor_class.'href="'.$this-&gt;base_url.$this-&gt;prefix.$i.$this-&gt;suffix.'"&gt;'.$this-&gt;last_link.'&lt;/a&gt;'.$this-&gt;last_tag_close;
          }
  
          // Kill double slashes.  Note: Sometimes we can end up with a double slash
          // in the penultimate link so we'll kill all double slashes.
          $output = preg_replace("#([^:])//+#", "\\1/", $output);
  
          // Add the wrapper HTML if exists
          $output = $this-&gt;full_tag_open.$output.$this-&gt;full_tag_close;
  
          return $output;
      }
  }
  // END Pagination Class
  
  /* End of file Pagination.php */
  /* Location: ./system/libraries/Pagination.php */
  </code></pre>
  
  <p>According to my pagination library, all my pagination links are printed out as <code>class="pagination-num"</code> and the <code>class="pagination-current"</code> is added only to the first pagination link , unbelievable :/</p>
  
  <p>When changing page, the pagination looks always as shown in this image, no changes between a page to another :/ </p>
  
  <p><img src="https://i.stack.imgur.com/QmM3s.png" alt="enter image description here"></p>