function index_action()
 {
     if (isset($_POST['apage'])) {
         $page = abs((int) $_POST['apage']);
     } else {
         if (isset($_GET['apage'])) {
             $page = abs((int) $_GET['apage']);
         } else {
             $page = 1;
         }
     }
     $tab = !empty($_GET['tab']) ? $_GET['tab'] : 'stats';
     $period_param = !empty($_REQUEST['period']) ? intval($_REQUEST['period']) : 7;
     $keywords = $this->_get_stat_keywords($page, $period_param);
     //run after get keywords list
     $page_links = $this->_build_pagination($page);
     $this->view->keywords = $keywords;
     $this->view->start = ($page - 1) * $this->_keywords_per_page;
     $this->view->sterm = !empty($_REQUEST['sterm']) ? stripslashes($_REQUEST['sterm']) : '';
     $this->view->period = $period_param;
     $this->view->page_links = $page_links;
     $this->view->page = $page;
     $this->view->total = !empty($this->_results['total_found']) ? $this->_results['total_found'] : 0;
     $this->view->keywords_per_page = $this->_keywords_per_page;
     $this->view->tab = $tab;
     $this->view->plugin_url = $this->_config->get_plugin_url();
 }
 function index_action()
 {
     if (!empty($_POST) && (!empty($_POST['doaction']) || !empty($_POST['doaction2']))) {
         $action = !empty($_POST['doaction']) ? $_POST['action'] : $_POST['action2'];
         switch ($action) {
             case 'approve':
                 $this->_approve_keywords($_POST['keywords']);
                 break;
             case 'ban':
                 $this->_ban_keywords($_POST['keywords']);
                 break;
             case 'import':
                 $this->_import_keywords($_POST['import_keywords']);
                 $this->view->success_message = 'Search terms added. New search terms will appear after next reindex of statistic index.';
                 break;
         }
     }
     if (isset($_POST['apage'])) {
         $page = abs((int) $_POST['apage']);
     } else {
         if (isset($_GET['apage'])) {
             $page = abs((int) $_GET['apage']);
         } else {
             $page = 1;
         }
     }
     $tab = !empty($_GET['tab']) ? $_GET['tab'] : 'new';
     $keywords = $this->_get_new_keywords($page, $tab);
     //run after get keywords list
     $page_links = $this->_build_pagination($page);
     $this->view->keywords = $keywords;
     $this->view->start = ($page - 1) * $this->_keywords_per_page;
     $this->view->sterm = !empty($_REQUEST['sterm']) ? stripslashes($_REQUEST['sterm']) : '';
     $this->view->page_links = $page_links;
     $this->view->page = $page;
     $this->view->total = !empty($this->_results['total_found']) ? $this->_results['total_found'] : 0;
     $this->view->keywords_per_page = $this->_keywords_per_page;
     $this->view->tab = $tab;
     $this->view->plugin_url = $this->_config->get_plugin_url();
 }