<commit_before><?php defined('SYSPATH') OR die('No direct script access.');

abstract class Boom_Core
{
	public static function include_css()
	{
		$css = Kohana::$config->load('media')->get('css');

		$assets = Assets::factory('cms_css');
		foreach ($css as $c)
		{
			$assets->css($c);
		}

		return $assets;
	}
	public static function include_js()
	{
		$core_js = Kohana::$config->load('media')->get('corejs');
		$js = Kohana::$config->load('media')->get('js');

		$assets = Assets::factory('cms_js');

		foreach ($core_js as $j)
		{
			$assets->js($j);
		}

		foreach ($js as $j)
		{
			$assets->js($j);
		}

		return $assets;
	}

	public static function page_format(Request $request)
	{
		// Change the controller action depending on the request accept header.
		$accepts = $request->accept_type();

		foreach (array_keys($accepts) as $accept)
		{
			switch ($accept)
			{
				case 'application/json':
					return 'json';
				case 'application/rss+xml':
					return 'rss';
					break;
				case 'text/html':
					return 'html';
				case '*/*':
					return 'html';
			}
		}

		throw new HTTP_Exception_406;
	}

	public static function process_uri(Route $route, array $params, Request $request)
	{
		if (substr($params['location'], 0, 1) == '_')
		{
			$page = \Boom\Page\ShortURL::pageFromUrl($params['location']);
		}
		else
		{
			$page_url = new Model_Page_URL(array('location' => $params['location']));

			if ( ! $page_url->loaded())
			{
				return false;
			}

			$page = \Boom\Finder\Page::byId($page_url->page_id);
		}

		if ($page->loaded())
		{
			// If the page has been deleted then return 410.
			if ($page->deleted)
			{
				throw new HTTP_Exception_410;
			}

			if ( ! isset($page_url) || ! $page_url->is_primary)
			{
				header('Location: '.$page->url(), null, 301);
				exit;
			}
<commit_msg>Bugfix: invisible pages were showing up in site view<commit_after><?php defined('SYSPATH') OR die('No direct script access.');

abstract class Boom_Core
{
	public static function include_css()
	{
		$css = Kohana::$config->load('media')->get('css');

		$assets = Assets::factory('cms_css');
		foreach ($css as $c)
		{
			$assets->css($c);
		}

		return $assets;
	}
	public static function include_js()
	{
		$core_js = Kohana::$config->load('media')->get('corejs');
		$js = Kohana::$config->load('media')->get('js');

		$assets = Assets::factory('cms_js');

		foreach ($core_js as $j)
		{
			$assets->js($j);
		}

		foreach ($js as $j)
		{
			$assets->js($j);
		}

		return $assets;
	}

	public static function page_format(Request $request)
	{
		// Change the controller action depending on the request accept header.
		$accepts = $request->accept_type();

		foreach (array_keys($accepts) as $accept)
		{
			switch ($accept)
			{
				case 'application/json':
					return 'json';
				case 'application/rss+xml':
					return 'rss';
					break;
				case 'text/html':
					return 'html';
				case '*/*':
					return 'html';
			}
		}

		throw new HTTP_Exception_406;
	}

	public static function process_uri(Route $route, array $params, Request $request)
	{
		if (substr($params['location'], 0, 1) == '_')
		{
			$page = \Boom\Page\ShortURL::pageFromUrl($params['location']);
		}
		else
		{
			$page_url = new Model_Page_URL(array('location' => $params['location']));

			if ( ! $page_url->loaded())
			{
				return false;
			}

			$page = \Boom\Finder\Page::byId($page_url->page_id);
		}

		if ($page->loaded())
		{
			// If the page has been deleted then return 410.
			if ($page->deleted)
			{
				throw new HTTP_Exception_410;
			}

			if ( ! $page->is_visible())
			{
				return false;
			}

			if ( ! isset($page_url) || ! $page_url->is_primary)
			{
				header('Location: '.$page->url(), null, 301);
				exit;
			}

{'fraction_non_alphanumeric': 0.1807455081791365, 'fraction_numerical': 0.007508715473317243, 'mean_word_length': 3.2482915717539864, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5732862', 'n_tokens_mistral': 1593, 'n_tokens_neox': 1309, 'n_words': 290}