title: Pagination not working properly in codeigniter
body: <p>I have pagination on my view which is working fine if i am clicking on next number link.like:</p>
  
  <pre><code>1 2 &gt; 
  </code></pre>
  
  <p>So if i am clicking on 2 it goes on second page and shows proper result.but now if i want to come back on 1 than its not redirecting me. Even if there is link 3 than i couldn't come on 2.</p>
  
  <p>Here is my code:</p>
  
  <p>Controller:</p>
  
  <pre><code>function list_providers()
  {
  
      $admin_session_data= $this-&gt;session-&gt;userdata('user_logged_in');
  
      $this-&gt;load-&gt;model('/admin/provider_model');
      $this-&gt;load-&gt;library('pagination');
      $this-&gt;load-&gt;helper('url');
  
      $config['base_url'] = base_url()."index.php/admin/provider/list_providers/";
      $config['total_rows'] = $this-&gt;provider_model-&gt;countprovider();
      $config['per_page'] = 3;
      $config['creat_link'] = 1;
      $config['first_link'] = 'First';
      $config['last_link'] = 'Last';
  
      $this-&gt;pagination-&gt;initialize($config);
      $offset=($this-&gt;uri-&gt;segment(4)) ? $this-&gt;uri-&gt;segment(4) : 0;
      $data['list']= $this-&gt;provider_model-&gt;listproviders($config['per_page'],$offset);
  
      //$data['customer']= $this-&gt;provider_model-&gt;getcustomer_data($config['per_page'],$this-&gt;uri-&gt;segment(3));
  
  
      if(!empty($data))
      {   
          $this-&gt;load-&gt;view('admin/admin_header',$admin_session_data); 
          $this-&gt;load-&gt;view('admin/admin_top_nav',$admin_session_data); 
          $this-&gt;load-&gt;view('admin/admin_left',$admin_session_data);
          $this-&gt;load-&gt;view('admin/provider_list',$data);
          $this-&gt;load-&gt;view('admin/admin_footer',$admin_session_data);
      }
  
  }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>function listproviders($num,$offset)
  {
      $this-&gt;load-&gt;library('pagination');
  
      //$query=$this-&gt;db-&gt;get_where('users', array('user_role_id'=&gt;'3'));
      $query=$this-&gt;db-&gt;get('users',$num,$offset);
  
      // return result set as an associative array
      return $query-&gt;result_array();
  }
  
  
  function countprovider()
  {
      $this-&gt;load-&gt;library('pagination');
      $query=$this-&gt;db-&gt;count_all_results('users');
      return $query;
  }
  </code></pre>
  
  <p>And my pagination is showing like this: 1 2 ></p>
  
  <p>Please see where is problem.</p>