/** * List all users as table * @return string * @throws \Ffcms\Core\Exception\NativeException * @throws \Ffcms\Core\Exception\SyntaxException */ public function actionIndex() { // init Active Record $query = new UserRecords(); // set current page and offset $page = (int) $this->request->query->get('page', 0); $offset = $page * self::ITEM_PER_PAGE; // build pagination $pagination = new SimplePagination(['url' => ['user/index'], 'page' => $page, 'step' => self::ITEM_PER_PAGE, 'total' => $query->count()]); // build listing objects $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get(); // display viewer return $this->view->render('index', ['records' => $records, 'pagination' => $pagination]); }