<commit_before><?php
class ContactsController extends Zend_Controller_Action
{
    public function init()
    {
        $this->_helper->loadResource->pseudoshareSetUp();
    }
    
    public function reverselistAction()
    {
        $auth = Zend_Auth::getInstance();
        $registry = Zend_Registry::getInstance();
        
        $router = Zend_Controller_Front::getInstance()->getRouter();
        
        $request = $this->getRequest();
        
        $page = $request->getUserParam("page");
        
        $userInfo = $registry->get("userInfo");
        
        $contacts = Ml_Model_Contacts::getInstance();
        
        $paginator = $contacts->getReverseContactsPage($userInfo['id'], 30, $page);
        
        //Test if there is enough pages or not
        if ((! $paginator->count() && $page != 1) ||
         $paginator->getCurrentPageNumber() != $page) {
         $this->_redirect($router->assemble(array("username"
            => $userInfo['alias']), 
            "contactsrev_1stpage"), array("exit"));
        }
        
        $this->view->paginator = $paginator;
    }
    
    public function listAction()
    {
        $auth = Zend_Auth::getInstance();
        $registry = Zend_Registry::getInstance();
        
        $router = Zend_Controller_Front::getInstance()->getRouter();
        
        $request = $this->getRequest();
        
        $page = $request->getUserParam("page");
        
        $userInfo = $registry->get("userInfo");
        
        $contacts = Ml_Model_Contacts::getInstance();
        
        $paginator = $contacts->getContactsPage($userInfo['id'], 30, $page);
             //Test if there is enough pages or not
        if ((! $paginator->count() && $page != 1) ||
         $paginator->getCurrentPageNumber() != $page) {
            $this->_redirect($router->assemble(array("username" => $userInfo['alias']), 
            "contacts_1stpage"), array("exit"));
        }
        
        $this->view->paginator = $paginator;
    }
    
    public function ignorelistAction()
    {
        $auth = Zend_Auth::getInstance();
        $registry = Zend_Registry::getInstance();
        
        $router = Zend_Controller_Front::getInstance()->getRouter();
        
        $request = $this->getRequest();
        $page = $request->getUserParam("page");
        
        $userInfo = $registry->get("userInfo");
        
        if($userInfo['id'] != $auth->getIdentity()) throw new Exception("403 Forbidden: you can see your own ignored list only.");
        
        $ignore = Ml_Model_Ignore::getInstance();
        
        $paginator = $ignore->getIgnorePage($userInfo['id'], 30, $page);<commit_msg>fix issue of ignore list appearing as a Application Error if user tried to access it without proper access<commit_after><?php
class ContactsController extends Zend_Controller_Action
{
    public function init()
    {
        $this->_helper->loadResource->pseudoshareSetUp();
    }
    
    public function reverselistAction()
    {
        $auth = Zend_Auth::getInstance();
        $registry = Zend_Registry::getInstance();
        
        $router = Zend_Controller_Front::getInstance()->getRouter();
        
        $request = $this->getRequest();
        
        $page = $request->getUserParam("page");
        
        $userInfo = $registry->get("userInfo");
        
        $contacts = Ml_Model_Contacts::getInstance();
        
        $paginator = $contacts->getReverseContactsPage($userInfo['id'], 30, $page);
        
        //Test if there is enough pages or not
        if ((! $paginator->count() && $page != 1) ||
         $paginator->getCurrentPageNumber() != $page) {
         $this->_redirect($router->assemble(array("username"
            => $userInfo['alias']), 
            "contactsrev_1stpage"), array("exit"));
        }
        
        $this->view->paginator = $paginator;
    }
    
    public function listAction()
    {
        $auth = Zend_Auth::getInstance();
        $registry = Zend_Registry::getInstance();
        
        $router = Zend_Controller_Front::getInstance()->getRouter();
        
        $request = $this->getRequest();
        
        $page = $request->getUserParam("page");
        
        $userInfo = $registry->get("userInfo");
        
        $contacts = Ml_Model_Contacts::getInstance();
        
        $paginator = $contacts->getContactsPage($userInfo['id'], 30, $page);
             //Test if there is enough pages or not
        if ((! $paginator->count() && $page != 1) ||
         $paginator->getCurrentPageNumber() != $page) {
            $this->_redirect($router->assemble(array("username" => $userInfo['alias']), 
            "contacts_1stpage"), array("exit"));
        }
        
        $this->view->paginator = $paginator;
    }
    
    public function ignorelistAction()
    {
        $auth = Zend_Auth::getInstance();
        $registry = Zend_Registry::getInstance();
        
        $router = Zend_Controller_Front::getInstance()->getRouter();
        
        $request = $this->getRequest();
        $page = $request->getUserParam("page");
        
        $userInfo = $registry->get("userInfo");
        
        if($userInfo['id'] != $auth->getIdentity()) {
            $registry->set("notfound", true);
            throw new Exception("403 Forbidden: you can see your own ignored list only.");
        }
        
        $ignore = Ml_Model_Ignore::getInstance();
        
        $paginator = $ignore->getIgnorePage($userInfo['id'], 30, $page);
{'fraction_non_alphanumeric': 0.15290687078549298, 'fraction_numerical': 0.004738472753781666, 'mean_word_length': 2.2589073634204277, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 70, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5904165', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1488, 'n_words': 271}