<commit_before><?php

namespace BoomCMS\Http\Controllers;

use BoomCMS\Contracts\Models\Page;
use BoomCMS\Core\Page\RssFeed;
use BoomCMS\Support\Facades\Router;
use Illuminate\Support\Facades\View;

class PageController extends Controller
{
    public function show()
    {
        $page = Router::getActivePage();
        $format = $this->request->format();

        if ($this->request->route()->getParameter('format')) {
            $format = $this->request->route()->getParameter('format');
        }

        $method = 'as'.ucfirst($format);

        if (method_exists($this, $method)) {
            return $this->$method($page);
        }

        abort(406);
    }

    public function asHtml(Page $page)
    {
        $template = $page->getTemplate();

        View::share('page', $page);

        return $template->getView();
    }

    public function asRss(Page $page)
    {
        return new RssFeed($page);
    }
}<commit_msg>Fixed issue with 404 pages causing an error<commit_after><?php

namespace BoomCMS\Http\Controllers;

use BoomCMS\Contracts\Models\Page;
use BoomCMS\Core\Page\RssFeed;
use BoomCMS\Support\Facades\Router;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\View;

class PageController extends Controller
{
    public function show(Request $request)
    {
        $page = Router::getActivePage();
        $format = $this->request->format();

        if ($request->route() && $request->route()->getParameter('format')) {
            $format = $request->route()->getParameter('format');
        }

        $method = 'as'.ucfirst($format);

        if (method_exists($this, $method)) {
            return $this->$method($page);
        }

        abort(406);
    }

    public function asHtml(Page $page)
    {
        $template = $page->getTemplate();

        View::share('page', $page);

        return $template->getView();
    }

    public function asRss(Page $page)
    {
        return new RssFeed($page);
    }
}
{'fraction_non_alphanumeric': 0.15239551478083588, 'fraction_numerical': 0.0045871559633027525, 'mean_word_length': 2.6760299625468167, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '1452924', 'n_tokens_mistral': 611, 'n_tokens_neox': 590, 'n_words': 113}