<commit_before><?php

require 'init.php';
require 'database.php';

// Re-usable component implementing counter
class Finder extends \atk4\ui\Columns
{
    public $route = [];

    public function setModel(\atk4\data\Model $model, $route = [])
    {
        parent::setModel($model);

        $this->addClass('internally celled');

        // lets add our first table here
        $table = $this->addColumn()->add(['Table', 'header'=>false, 'very basic selectable'])->addStyle('cursor', 'pointer');
        $table->setModel($model, [$model->title_field]);

        $selections = isset($_GET[$this->name]) ? explode(',', $_GET[$this->name]) : [];

        if ($selections) {
            $table->js(true)->find('tr[data-id='.$selections[0].']')->addClass('active');
        }

        $path = [];
        $js_reload = new \atk4\ui\jsReload($this, [$this->name => new \atk4\ui\jsExpression('[]+[]', [
            $path ? (implode(',', $path).',') : '',
            new \atk4\ui\jsExpression('$(this).data("id")'),
        ])]);
        $table->on('click', 'tr', $js_reload);

        while ($selections && $id = array_shift($selections)) {
            $path[] = $id;
            $model->load($id);
            $ref = array_shift($route);
            if (!$route) {
                $route[] = $ref; // repeat last route
            }

            if (!$model->hasRef($ref)) {
                break; // no such route
            }

            $model = $model->ref($ref);

            $table = $this->addColumn()->add(['Table', 'header'=>false, 'very basic selectable'])->addStyle('cursor', 'pointer');
            $table->setModel($model, [$model->title_field]);

            if ($selections) {
                $table->js(true)->find('tr[data-id='.$selections[0].']')->addClass('active');
            }

            $js_reload = new \atk4\ui\jsReload($this, [$this->name => new \atk4\ui\jsExpression('[]+[]', [
                $path ? (implode(',', $path).',') : '',
                new \atk4\ui\jsExpression('$(this).data("id")'),
            ])]);
            $table->on('click', 'tr', $js_reload);
        }
<commit_msg>fix 404 error<commit_after><?php

require 'init.php';
require 'database.php';

// Re-usable component implementing counter
class Finder extends \atk4\ui\Columns
{
    public $route = [];

    public function setModel(\atk4\data\Model $model, $route = [])
    {
        parent::setModel($model);

        $this->addClass('internally celled');

        // lets add our first table here
        $table = $this->addColumn()->add(['Table', 'header'=>false, 'very basic selectable'])->addStyle('cursor', 'pointer');
        $table->setModel($model, [$model->title_field]);

        $selections = isset($_GET[$this->name]) ? explode(',', $_GET[$this->name]) : [];

        if ($selections) {
            $table->js(true)->find('tr[data-id='.$selections[0].']')->addClass('active');
        }

        $path = [];
        $js_reload = new \atk4\ui\jsReload($this, [$this->name => new \atk4\ui\jsExpression('[]+[]', [
            $path ? (implode(',', $path).',') : '',
            new \atk4\ui\jsExpression('$(this).data("id")'),
        ])]);
        $table->on('click', 'tr', $js_reload);

        while ($selections && $id = array_shift($selections)) {
            $path[] = $id;
            $model->tryLoad($id);
            if (!$model->loaded()) {
              break;
            }
            $ref = array_shift($route);
            if (!$route) {
                $route[] = $ref; // repeat last route
            }

            if (!$model->hasRef($ref)) {
                break; // no such route
            }

            $model = $model->ref($ref);

            $table = $this->addColumn()->add(['Table', 'header'=>false, 'very basic selectable'])->addStyle('cursor', 'pointer');
            $table->setModel($model, [$model->title_field]);

            if ($selections) {
                $table->js(true)->find('tr[data-id='.$selections[0].']')->addClass('active');
            }

            $js_reload = new \atk4\ui\jsReload($this, [$this->name => new \atk4\ui\jsExpression('[]+[]', [
                $path ? (implode(',', $path).',') : '',
                new \atk4\ui\jsExpression('$(this).data("id")'),
            ])]);
            $table->on('click', 'tr', $js_reload);
        }

{'fraction_non_alphanumeric': 0.2219902574808629, 'fraction_numerical': 0.005335189051264208, 'mean_word_length': 2.1405680990531684, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 64, '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': '4360606', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1310, 'n_words': 225}