public function rest($path) { View::setLayout('plain'); View::setTemplate('api'); $model = $this->getModel($path); $model->limit(Input::get('limit')); $model->offset((Input::get('page') - 1) * Input::get('limit')); header("X-Item-Count: " . $model->count()); View::set('response', $model->fetch()->toArray()); }