title: How to integrate pagination in Kohana?
body: <p>I am trying to integrate pagination in kohana, but don't know how to integrate it. Following is the controller function </p>
  
  <pre><code>public function action_index() {
          //setup the model and view
          $_users = Model::factory('users');
          $us = $_users-&gt;get_users();
  
          $view = View::factory('users/index')-&gt;bind('user_list', $us);
          $this-&gt;template-&gt;set('content',$view);
      }
  </code></pre>
  
  <p>How can i add pagination in this function?
  I found some code for pagination but couldn't integrate it. This is the function i found</p>
  
  <pre><code> $this-&gt;pagination = new Pagination(array(
              'base_url'    =&gt; 'users/index/', 
              'uri_segment' =&gt; 'page',
              'total_items' =&gt; count($items-&gt;get_item_count())
  </code></pre>
  
  <p>Please help me</p>
  
  <p>EDIT:
  I tried something like </p>
  
  <pre><code>public function action_index(){
  
      $query = DB::select()-&gt;from('user');
      // count number of users
      $total_users = count($query);;
      // set-up the pagination
      $pagination = Pagination::factory(array(
          'total_items' =&gt; $total_users,
          'items_per_page' =&gt; 10, // this will override the default set in your config
      ));
      // select rows using pagination's limit&amp;offset 
      $users = $query-&gt;offset($pagination-&gt;offset)-&gt;limit($pagination-&gt;items_per_page)-&gt;execute();
      $view = View::factory('users/index')-&gt;bind('user_list', $users)-&gt;bind('pagination', $pagination);
      $this-&gt;template-&gt;set('content',$view);
  }
  </code></pre>
  
  <p>Now no error found but pagination not showing up. Used shadowhand's pagination module suggested by @DanielThompson</p>