$start = getPaginationStart($page);
         $count = $p->countPageList();
         $number_of_pages = ceil($count / LIMIT);
         $pages = $p->showPageList($start, LIMIT);
         $app->render(ADMIN_THEME . 'pages.php', array('pages' => $pages, 'number_of_pages' => $number_of_pages, 'current_page' => $page, 'page_name' => 'pages'));
     });
 });
 /*
  * Blocks group
  * Manage block content
  */
 $app->group('/blocks', function () use($app) {
     $app->post('/', 'isValidReferrer', 'validateUser', function () use($app) {
         $data = $app->request->post();
         $b = new Blocks();
         $b->addToBlockList($data);
         $method = isset($data['id']) && $data['id'] > 0 ? 'edited' : 'added';
         $app->flash('success', "Block successfully {$method}.");
         $app->redirect(ADMIN_URL . 'blocks');
     });
     $app->get('/new', 'validateUser', function () use($app) {
         $app->render(ADMIN_THEME . 'blocks.new.php', array('method' => 'new'));
     });
     $app->get('/edit/:id', 'validateUser', function ($id) use($app) {
         $b = new Blocks();
         $block = $b->showBlock($id);
         $app->render(ADMIN_THEME . 'blocks.edit.php', array('block' => $block, 'method' => 'edit'));
     });
     $app->get('/delete/:id', 'validateUser', function ($id) use($app) {
         $b = new Blocks();
         $b->deleteFromBlock($id);