title: codeigniter pagination error 404
body: <p>I have Admin controller in codeigniter</p>
  
  <pre><code>class Admin extends CI_Controller {
  
  function __construct() {
  
      parent::__construct();
  
      if (!$this-&gt;tank_auth-&gt;is_logged_in()) redirect('login');
      $this-&gt;load-&gt;library('pagination');
  
  }
  
  function index() {
  
      $offset = $this-&gt;uri-&gt;segment(2);
      $config['per_page'] = 3;
      $data['sitetitle'] = 'Výpis jobů';
      $data['listings'] = $this-&gt;Jobs_model-&gt;get_listings(0,$user_id = FALSE,$config['per_page'],$offset);
      $config['uri_segment'] = 2; 
      $config['base_url']     = base_url().'admin/';
      $config['total_rows']   = $this-&gt;db-&gt;count_all_results('jobs');
  
  
      $this-&gt;pagination-&gt;initialize($config);
  
      $this-&gt;template-&gt;set('title', 'Domovská stránka');
      $this-&gt;template-&gt;load('template', 'site', $data);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and Jobs_model</p>
  
  <pre><code>function get_listings($category, $user_id = false, $limit = 0, $offset = 0) {
  
      $data = array();
  
      $this-&gt;db-&gt;order_by('id', 'desc');
      $q = $this-&gt;db-&gt;get('jobs');
  
      if ($category) {
          $options = array('category' =&gt; $category);
          $this-&gt;db-&gt;order_by('id', 'desc');
          $this-&gt;db-&gt;where('category', $category);
          $q = $this-&gt;db-&gt;get('jobs', $limit, $offset);
      }
      else {
          $query = $this-&gt;db-&gt;order_by('id', 'desc');
          if ($user_id) $query = $query-&gt;where('user_id', $user_id);
          $q = $query-&gt;get('jobs',$limit, $offset);
      }
  
      if ($q-&gt;num_rows() &gt; 0) {
          foreach ($q-&gt;result_array() as $row) {
              $data[] = $row;
          }
      }
  
      $q-&gt;free_result();
      return $data;
  }
  </code></pre>
  
  <p>first page in paginatiom  obtain data, but links generating in pagination localhost/sitename/admin/3 produce 404 error. 
  Where is problem in my script</p>