title: pagination doesn't work in codeigniter
body: <p>I have successfully created pagination on some of the pages on the application on which I am working with, but I can't make it on this one:</p>
  
  <p>I have 7 records in the database, and when 
  page is displayed all 7 records are displayed instead of 5, as I would like to be.</p>
  
  <p>Sure enough, links for the paging are not displayed.</p>
  
  <p>Here is my controller code:</p>
  
  <pre><code>public function displayAllFaqCategories()
      {
  
           //initializing &amp; configuring paging
  
          $currentUser = $this-&gt;isLoggedIn();
          $this-&gt;load-&gt;model('faqCategoriesModel');
          $this-&gt;db-&gt;order_by('sorder');
          $limit = 5;
          $offset = 3;
  
          $offset = $this-&gt;uri-&gt;segment(3);
          $this-&gt;db-&gt;limit(5, $offset);
  
          $data['faq_categories'] = $this-&gt;faqCategoriesModel-&gt;selectCategoriesAndParents();
          $totalresults = $this-&gt;db-&gt;get('faq_categories')-&gt;num_rows();
  
          //initializing &amp; configuring paging
          $this-&gt;load-&gt;library('pagination');
          $config['base_url'] = site_url('/backOfficeUsers/faqcategories');
          $config['total_rows'] = $totalresults;
          $config['per_page'] = 5;
          $config['uri_segment'] = 3;
  
  
          $this-&gt;pagination-&gt;initialize($config); 
  
          $errorMessage = '';
          $data['main_content'] = 'faq/faqcategories';
          $data['title'] = 'FAQ Categories';
  
          $this-&gt;load-&gt;vars($data,$errorMessage);
          $this-&gt;load-&gt;vars($currentUser);
          $this-&gt;load-&gt;view('backOffice/template');
  
      } // end of function displayAllFaqCategories
  </code></pre>
  
  <p>And here is my model function code:</p>
  
  <pre><code>public function selectCategoriesAndParents($selectWhat = array())
     {    
         $data = array();
         $query = $this-&gt;db-&gt;query("SELECT fq . * , COALESCE( fqp.$this-&gt;parent_name,  '0' ) AS parentname
                                    FROM $this-&gt;table_name AS fq
                                    LEFT OUTER JOIN $this-&gt;table_name AS fqp ON fqp.catid = fq.parentid"); 
         if($query-&gt;num_rows() &gt; 0) 
         {
             foreach($query-&gt;result_array() as $row) 
                 {
                     $data[] = $row;  
                 }
             }           
         $query-&gt;free_result();
         return $data;
     } // end of function selectCategoriesAndParents    
  </code></pre>
  
  <p>In the view, bellow of the table with the records I have the following code:</p>
  
  <pre><code> &lt;?php echo $this-&gt;pagination-&gt;create_links();?&gt;
  </code></pre>
  
  <p>Any help will be deeply appreciated.</p>
  
  <p>Regards,Zoran</p>