title: I am getting the pagination and the page links but the links are not working properly
body: <p>I am trying to get pagination using codeigniter. But on a page I am getting all the records from db.I want all the pages to be divided but it is not happening. I want a solution uregently. I have searched all the forums but not getting a solution.</p>
  
  <p>My Controller goes like this:</p>
  
  <pre><code>public function catalogs()
      {
  
          $this-&gt;load-&gt;library("pagination");
          $this-&gt;load-&gt;model('Cataloguemodel');
  
          $get_vars = $this-&gt;input-&gt;get();
          if(is_array($get_vars))
          $config['suffix'] = '?'.http_build_query($get_vars,'', "&amp;");
          $config['base_url'] = base_url() . $this-&gt;router-&gt;class."/catalogs";
          $config['first_url'] = $config['base_url'] . (isset($config['suffix'])?$config['suffix']:'');
  
          $config['total_rows'] = $this-&gt;Cataloguemodel-&gt;record_count();
          $config['per_page'] = 2;
          $config['uri_segment'] = $this-&gt;uri-&gt;segment(3);
  
  
          $config["num_links"] = 4;
  
          $config['full_tag_open'] = '&lt;ul class="pagination"&gt;';
          $config['full_tag_close'] = '&lt;/ul&gt;';
          $config['first_link'] = false;
          $config['last_link'] = false;
          $config['first_tag_open'] = '&lt;li&gt;';
          $config['first_tag_close'] = '&lt;/li&gt;';
          $config['prev_link'] = '&amp;laquo';
          $config['prev_tag_open'] = '&lt;li class="prev"&gt;';
          $config['prev_tag_close'] = '&lt;/li&gt;';
          $config['next_link'] = '&amp;raquo';
          $config['next_tag_open'] = '&lt;li&gt;';
          $config['next_tag_close'] = '&lt;/li&gt;';
          $config['last_tag_open'] = '&lt;li&gt;';
          $config['last_tag_close'] = '&lt;/li&gt;';
          $config['cur_tag_open'] = '&lt;li class="active"&gt;&lt;a href="#"&gt;';
          $config['cur_tag_close'] = '&lt;/a&gt;&lt;/li&gt;';
          $config['num_tag_open'] = '&lt;li&gt;';
          $config['num_tag_close'] = '&lt;/li&gt;';
  
  
  
          $this-&gt;pagination-&gt;initialize($config);
  
          $page = ($this-&gt;uri-&gt;segment(3))? $this-&gt;uri-&gt;segment(3) : 0;
  
  
          $data['catalist'] = $this-&gt;Cataloguemodel-&gt;Cataloguelist($config['per_page'], $page);
  
          $data['links'] = $this-&gt;pagination-&gt;create_links();
  
          $this-&gt;load-&gt;view('header');
          $this-&gt;load-&gt;view('features',$data);
          $this-&gt;load-&gt;view('footer');
      }
  }
  </code></pre>
  
  <p>My model goes like this</p>
  
  <pre><code>public function Cataloguelist($limit= null, $start= null)
      {
          $this-&gt;db-&gt;limit($limit, $start);
  
          $returncataarray = array();
  
          $sql = "select id, name, image, catalogue, description from tbl_catalogues";
          $query = $this-&gt;db-&gt;query($sql);
  
          if($query-&gt;num_rows())
          {
              $rows = $query-&gt;result();
  
              foreach($rows as $tempcata)
              {
                  $smallcataarray = array();
  
                  $smallcataarray['id'] = $tempcata-&gt;id;
                  $smallcataarray['name'] = $tempcata-&gt;name;
                  $smallcataarray['image'] = $tempcata-&gt;image;
                  $smallcataarray['catalogue'] = $tempcata-&gt;catalogue;
                  $smallcataarray['description'] = $tempcata-&gt;description;
  
                  array_push($returncataarray, $smallcataarray);
              }
          }
  
          return $returncataarray;
      }
  
       public function record_count() 
      {
          return $this-&gt;db-&gt;count_all("tbl_catalogues");
      }
  </code></pre>
  
  <p>}</p>
  
  <p>Views goes like this.</p>
  
  <pre><code>&lt;section id="main-container"&gt;
          &lt;div class="container"&gt;
  
              &lt;!-- About us --&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-md-12"&gt;
                      &lt;h2 class="article-title"&gt;Catalogues&lt;/h2&gt;
                  &lt;/div&gt;
              &lt;/div&gt;&lt;!-- Title row end --&gt;
  
              &lt;div class="feature-items"&gt;
              &lt;?php
              foreach($catalist as $tempcat)
              { 
              ?&gt;
                  &lt;h3 class="title-normal"&gt;&lt;strong&gt;&lt;?php echo $tempcat['name'];?&gt;&lt;/strong&gt;&lt;/h3&gt;
                  &lt;div class="row"&gt;
                      &lt;div class="col-sm-2 feature-item-img"&gt;&lt;img class="img-responsive" src="admin/&lt;?php echo $tempcat['image'];?&gt;" alt="" width="200" height="200"&gt;&lt;/div&gt;
                      &lt;div class="col-sm-8 feature-item-content"&gt;
                          &lt;p&gt;&lt;?php echo $tempcat['description'];?&gt;&lt;/p&gt;
                           &lt;a href="admin/&lt;?php echo $tempcat['catalogue'];?&gt;"&gt;Download Catalogue&lt;/a&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
  
  
              &lt;div class="ts-divider"&gt;&amp;nbsp;&lt;/div&gt;
              &lt;?php
              }
              ?&gt;
  
              &lt;div class="paging text-center"&gt;
              &lt;ul class="pagination"&gt;
                  &lt;li&gt;&lt;?php echo $links;?&gt;&lt;/li&gt;
              &lt;/ul&gt;
              &lt;/div&gt;
  
  
          &lt;/div&gt;
  </code></pre>