title: Codeigniter - The Next button changes the value and data on the page, but it the "active" class doesn't change
body: <p>What I'm trying to do is create a pagination function. I have successfully created that. It works. The URI segment changes and everything. It's perfect. However, there is a small problem. When I press the "next" button or press another number to go to the next page, the "page 1" is still highlighted for some reason. I can't click it to go to the first page. The "Previous" button show up either. So after I go to a second page or any other page, other than 1, I cannot get back to the first page. The only way I can go back to the first page is by changing the URI segment.</p>
  
  <p>I couldn't find an answer to this specific question, so any help is highly appreciated.
  Thanks.</p>
  
  <p>My Model:</p>
  
  <pre><code>public function record_count_sitelog()
  {
      $uid = $this-&gt;uri-&gt;segment(4);
      return $this-&gt;db-&gt;get_where('site_log', array('uid' =&gt; $uid))-&gt;num_rows();
  }
  
  public function fetch_users_sitelog($limit, $start)
  {
      $this-&gt;db-&gt;order_by("time", "desc"); //ordering it in descending order
      $uid = $this-&gt;uri-&gt;segment(4);
      $this-&gt;db-&gt;limit($limit, $start);
  
      $query = $this-&gt;db-&gt;get_where('site_log', array('uid' =&gt; $uid));
  
      if ($query-&gt;num_rows() &gt; 0) {
          foreach ($query-&gt;result() as $row) {
              $data[] = $row;
          }
          return $data;
      }
      return false;
  }
  </code></pre>
  
  <p>My Controller:</p>
  
  <pre><code>public function site_log() {
      $uid = $this-&gt;uri-&gt;segment(4);
  
      $data = array( 'uid' =&gt; $uid
      );
  
      $this-&gt;load-&gt;model('Model_Admin_Pagination');
      $this-&gt;load-&gt;library('pagination');
      $this-&gt;load-&gt;library('table');
  
      $config = array();
      $config["base_url"] = base_url() . "admin/users/site_log/". $uid ."/";
      $this-&gt;db-&gt;select('*');
      $config["total_rows"] = $this-&gt;Model_Admin_Pagination-&gt;record_count_sitelog();
      $config["per_page"] = 20;
      $config["uri_segment"] = 4;
      $config["num_links"] = 3;
      $config['records'] = $this-&gt;db-&gt;select('*');
      //styling it
      $config['full_tag_open'] = '&lt;div class="pull-right"&gt; &lt;ul class="pagination"&gt;';
      $config['full_tag_close'] = '&lt;/div&gt;&lt;/ul&gt;';
      $config['num_tag_open'] = '&lt;li&gt;';
      $config['num_tag_close'] = '&lt;/li&gt;';
      $config['next_link'] = '→';
      $config['next_tag_open'] = '&lt;li&gt;';
      $config['next_tag_close'] = '&lt;/li&gt;';
      $config['prev_link'] = '←';
      $config['cur_tag_open'] = '&lt;li class="active"&gt;&lt;a&gt;';
      $config['cur_tag_close'] = '&lt;/li&gt;&lt;/a&gt;';
      $config['prev_tag_open'] = '&lt;li&gt;';
      $config['prev_tag_close'] = '&lt;/li&gt;';
      $config['last_link'] = '»';
      $config['last_tag_open'] = '&lt;li&gt;';
      $config['last_tag_close'] = '&lt;/li&gt;';
      $config['first_link'] = '«';
      $config['first_tag_open'] = '&lt;li&gt;';
      $config['first_tag_close'] = '&lt;/li&gt;';
      //end styling it
  
      $page = ($this-&gt;uri-&gt;segment(5)) ? $this-&gt;uri-&gt;segment(5) : 0;
      $data["results"] = $this-&gt;Model_Admin_Pagination-&gt;
      fetch_users_sitelog($config["per_page"], $page);
      $data["links"] = $this-&gt;pagination-&gt;create_links();
  
      $this-&gt;pagination-&gt;initialize($config);
  
      $this-&gt;load-&gt;view('admin/includes/header');
      $this-&gt;load-&gt;view('admin/view_site_log', $data);
  }
  </code></pre>
  
  <p>My View:</p>
  
  <pre><code>    &lt;?php
  if (is_array($results))
  {
      foreach ($results as $data) { ?&gt;
          &lt;div&gt; &lt;!--class="col-md-6 col-sm-6"--&gt;
              &lt;div class="well pretty-text"&gt;
                  &lt;p&gt;
                      &lt;h3&gt;&lt;font color="#708090"&gt;Time:&lt;/font&gt; &lt;?php echo date("g:i A", strtotime($data-&gt;time)). ' on ' . date("F j, Y", strtotime($data-&gt;time)) ?&gt;&lt;br&gt;&lt;/h3&gt;
                      &lt;b&gt;Current URL:&lt;/b&gt; &lt;?php echo $data-&gt;current_url ?&gt;&lt;br&gt;
                      Referrer: &lt;?php echo $data-&gt;referrer ?&gt;&lt;br&gt;
                      &lt;b&gt;Browser:&lt;/b&gt; &lt;?php echo $data-&gt;browser ?&gt;&lt;br&gt;
  
                      Mobile: &lt;?php echo $data-&gt;mobile ?&gt;&lt;br&gt;
                      &lt;b&gt;Platform:&lt;/b&gt; &lt;?php echo $data-&gt;platform ?&gt;&lt;br&gt;
                  &lt;b&gt;User Agent:&lt;/b&gt; &lt;?php echo $data-&gt;user_agent ?&gt;
  
                  &lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;?php } } ?&gt;
  
  &lt;?php  echo $this-&gt;pagination-&gt;create_links(); ?&gt;
  </code></pre>