/**
  * Pagination
  * @param Model_Item $model
  * @param Array $settings
  */
 protected function pagination($model, $settings)
 {
     // dont paginate
     if ($settings === FALSE || !isset($settings['step'])) {
         return;
     }
     // get offset from state
     $offset = $this->_state->get('pagination.offset', 0);
     // override offset from request
     if ($this->request->query('offset') != NULL) {
         $offset = $this->request->query('offset');
     }
     // store offset
     $this->_state->set('pagination.offset', $offset);
     // get total from state
     $total = $this->_state->get('pagination.total', FALSE);
     // if no total is known (or 0), fire a query
     if (!$total) {
         // get the total
         $total = $model->count();
         // store  total
         $this->_state->set('pagination.total', $total);
     }
     // set limit and offset on the model
     $model->amount($settings['step']);
     $model->skip($offset);
 }