<commit_before><?php

namespace BoomCMS\Core\Page\Finder;

use BoomCMS\Core\Editor\Editor;
use BoomCMS\Core\Finder\Finder as BaseFinder;
use BoomCMS\Core\Models\Page as Model;
use BoomCMS\Core\Page\Page;

use Illuminate\Support\Facades\App;

class Finder extends BaseFinder
{
    const TITLE = 'version.title';
    const MANUAL = 'sequence';
    const DATE = 'visible_from';
    const EDITED = 'edited_time';

    public function __construct(Editor $editor = null)
    {
        $this->editor = $editor ?: App::make('BoomCMS\Core\Editor\Editor');

        $this->query = Model::currentVersion($editor)->withUrl();

        if ($this->editor->isDisabled()) {
            $this->query = $this->query->isVisible();
        }
    }

    public function find()
    {
        $model = parent::find();

         return $model? new Page($model->toArray()): new Page([]);
    }

    public function findAll()
    {
        $pages = parent::findAll();
        $return = [];

        foreach ($pages as $page) {
            $return[] = new Page($page->toArray());
        }
<commit_msg>Bugfix: invisible pages showing up to users who aren't logged in<commit_after><?php

namespace BoomCMS\Core\Page\Finder;

use BoomCMS\Core\Editor\Editor;
use BoomCMS\Core\Finder\Finder as BaseFinder;
use BoomCMS\Core\Models\Page as Model;
use BoomCMS\Core\Page\Page;

use Illuminate\Support\Facades\App;

class Finder extends BaseFinder
{
    const TITLE = 'version.title';
    const MANUAL = 'sequence';
    const DATE = 'visible_from';
    const EDITED = 'edited_time';

    public function __construct(Editor $editor = null)
    {
        $this->editor = $editor ?: App::make('BoomCMS\Core\Editor\Editor');

        $this->query = Model::currentVersion($editor)->withUrl();

        if ( !$this->editor->isEnabled()) {
            $this->query = $this->query->isVisible();
        }
    }

    public function find()
    {
        $model = parent::find();

         return $model? new Page($model->toArray()): new Page([]);
    }

    public function findAll()
    {
        $pages = parent::findAll();
        $return = [];

        foreach ($pages as $page) {
            $return[] = new Page($page->toArray());
        }

{'fraction_non_alphanumeric': 0.15213442325158946, 'fraction_numerical': 0.0, 'mean_word_length': 2.708754208754209, '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': '2479167', 'n_tokens_mistral': 700, 'n_tokens_neox': 679, 'n_words': 152}