title: Codeigniter 3: pagination only displays the first 10 records
body: <p>I am trying to paginate a <strong>Codeigniter 3</strong> application without using the framework's pagination library. More exactly, I want to <em>paginate a table with about 100 rows</em>. For this purpose:</p>
  
  <p>In the home controller I have:</p>
  
  <pre><code>public function index() {
      $this-&gt;load-&gt;model('Customer');
      $this-&gt;load-&gt;library('pagination');
      $config = [
          'base_url' =&gt; base_url("index.php"),
          'per_page' =&gt; 10,
          'total_rows' =&gt; $this-&gt;Customer-&gt;get_num_rows(),
          'uri_segment' =&gt; 3,
          'first_tag_open' =&gt;  '&lt;li&gt;',
          'first_tag_close' =&gt; '&lt;/li&gt;',
          'last_tag_open' =&gt;  '&lt;li&gt;',
          'last_tag_close' =&gt; '&lt;/li&gt;',
          'full_tag_open' =&gt;  '&lt;ul class="pagination"&gt;',
          'full_tag_close' =&gt; '&lt;/ul&gt;',
          'next_tag_open' =&gt;  '&lt;li&gt;',
          'next_tag_close' =&gt; '&lt;/li&gt;',
          'prev_tag_open' =&gt;  '&lt;li&gt;',
          'prev_tag_close' =&gt; '&lt;/li&gt;',
          'num_tag_open' =&gt;   '&lt;li&gt;',
          'num_tag_close' =&gt;  '&lt;/li&gt;',
          'cur_tag_open' =&gt;   '&lt;li class="active"&gt;&lt;a&gt;',
          'cur_tag_close' =&gt;  '&lt;/a&gt;&lt;/li&gt;',
      ];
      $this-&gt;pagination-&gt;initialize($config);
      $customers = $this-&gt;Customer-&gt;getCustomers($config['per_page'], $this-&gt;uri-&gt;segment($config['uri_segment']));
      $this-&gt;load-&gt;view('home', ['records'=&gt;$customers]);
  }
  </code></pre>
  
  <p>In the Model file I have:</p>
  
  <pre><code>class Customer extends CI_Model {
   public function __construct() {
      $this-&gt;load-&gt;database();
   }
  
   public function getCustomers($limit, $offset) {
      $this-&gt;db-&gt;limit($limit, $offset);
      $query = $this-&gt;db-&gt;get('customers');
      return $query-&gt;result();
   }
  }
  </code></pre>
  
  <p>Finaly, the view:</p>
  
  <pre><code>&lt;div class="pagination-container text-center"&gt;
      &lt;?php echo $this-&gt;pagination-&gt;create_links(); ?&gt;
  &lt;/div&gt; 
  </code></pre>
  
  <p>The pagination is displayed and properly formatted; so are the <strong>first 10 records</strong>:
  <a href="https://i.stack.imgur.com/1Roe3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Roe3.png" alt="enter image description here"></a></p>
  
  <p>But if I click on page 2, or any other page, I get the <strong>same first 10 records</strong> as can be seen in the image below:</p>
  
  <p><a href="https://i.stack.imgur.com/7lEzB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7lEzB.png" alt="enter image description here"></a></p>
  
  <p>The url of page 2 is:</p>
  
  <pre><code>http://localhost/cicrud/index.php?page=2
  </code></pre>
  
  <p>I did something wrong, I can't understand what. Any help? Thank you!</p>