<commit_before><?php

namespace monad;
use monolyth\db;
use monolyth\Controller;
use monolyth\HTTP404_Exception;

class Static_Page_Controller extends Controller
{
    protected function get(array $args)
    {
        extract($args);
        if (!($page = $this->pages->find($slug))) {
            throw new HTTP404_Exception();
        }
        return $this->view($page['viewname'], compact('page'));
    }

    public function arguments(array $args = [])
    {
        $new = $args + parent::arguments();
        if (!isset($new['language'])) {
            return $new;
        }
        $language = $this->language->current->id;
        foreach ($this->language->available as $lang) {
            if ($lang->code == $new['language']) {
                $language = $lang->id;
                break;
            }
        }
        $page = $this->pages->find($new['slug'], $language);
        $new['slug'] = $page['slug'];
        return $new;
    }
}
<commit_msg>modernize<commit_after><?php

namespace monad;
use monolyth\db;
use monolyth\Controller;
use monolyth\HTTP404_Exception;

class Static_Page_Controller extends Controller
{
    use Page_Access;

    protected function get(array $args)
    {
        extract($args);
        if (!($page = self::pages()->find($slug))) {
            throw new HTTP404_Exception();
        }
        return $this->view($page['viewname'], compact('page'));
    }

    public function arguments(array $args = [])
    {
        $new = $args + parent::arguments();
        if (!isset($new['language'])) {
            return $new;
        }
        $language = self::language()->current->id;
        foreach (self::language()->available as $lang) {
            if ($lang->code == $new['language']) {
                $language = $lang->id;
                break;
            }
        }
        $page = self::pages()->find($new['slug'], $language);
        $new['slug'] = $page['slug'];
        return $new;
    }
}

{'fraction_non_alphanumeric': 0.1683725690890481, 'fraction_numerical': 0.006141248720573183, 'mean_word_length': 2.163430420711974, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '89035', 'n_tokens_mistral': 574, 'n_tokens_neox': 565, 'n_words': 116}