<commit_before><?php

namespace Octo\System\Admin\Controller;

use b8\Config;
use Octo\Admin\Controller;
use Octo\Event;
use Octo\Store;
use Octo\System\Model\Setting;

class DashboardController extends Controller
{
    public function index()
    {
        $this->setTitle(Config::getInstance()->get('site.name') . ': Dashboard');
        $this->addBreadcrumb('Dashboard', '/');
        
        $moduleManager = Config::getInstance()->get('ModuleManager');

        $pageStore = Store::get('Page');

        if ($pageStore && $moduleManager->isEnabled('Pages')) {
            $this->view->pages = $pageStore->getTotal();
            $this->view->latestPages = $pageStore->getLatest(5);
        }

        if ($moduleManager->isEnabled('Forms')) {
            $contactStore = Store::get('Contact');

            if ($contactStore) {
                $this->view->contacts = $contactStore->getTotal();
            }

            $submissionStore = Store::get('Submission');

            if ($submissionStore) {
                $this->view->submissions = $submissionStore->getTotal();
                $this->view->latestSubmissions = $submissionStore->getAll(0, 5);
            }
        }

        $this->view->showAnalytics = false;
        if (Setting::get('analytics', 'ga_email') != '') {
            $this->view->showAnalytics = true;
        }
        
        Event::trigger('dashboardLoad', $this);
    }
}<commit_msg>Add override listener to Dashboard.<commit_after><?php

namespace Octo\System\Admin\Controller;

use b8\Config;
use Octo\Admin\Controller;
use Octo\Event;
use Octo\Store;
use Octo\System\Model\Setting;

class DashboardController extends Controller
{
    public function index()
    {
        $this->setTitle(Config::getInstance()->get('site.name') . ': Dashboard');
        $this->addBreadcrumb('Dashboard', '/');
        
        $moduleManager = Config::getInstance()->get('ModuleManager');

        $pageStore = Store::get('Page');

        if ($pageStore && $moduleManager->isEnabled('Pages')) {
            $this->view->pages = $pageStore->getTotal();
            $this->view->latestPages = $pageStore->getLatest(5);
        }

        if ($moduleManager->isEnabled('Forms')) {
            $contactStore = Store::get('Contact');

            if ($contactStore) {
                $this->view->contacts = $contactStore->getTotal();
            }

            $submissionStore = Store::get('Submission');

            if ($submissionStore) {
                $this->view->submissions = $submissionStore->getTotal();
                $this->view->latestSubmissions = $submissionStore->getAll(0, 5);
            }
        }

        $this->view->showAnalytics = false;
        if (Setting::get('analytics', 'ga_email') != '') {
            $this->view->showAnalytics = true;
        }
        
        $instance = clone($this); // Can't pass and return $this to a listener, sadface.
        Event::trigger('dashboardLoad', $instance);
        $this->view = $instance->view;
    }
}
{'fraction_non_alphanumeric': 0.16478029294274302, 'fraction_numerical': 0.002663115845539281, 'mean_word_length': 2.3954802259887007, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, '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': '2762661', 'n_tokens_mistral': 863, 'n_tokens_neox': 838, 'n_words': 137}