<commit_before><?php

	/**
	 * @package content
	 */

	/**
	 * Developers can create new Frontend pages from this class. It provides
	 * an index view of all the pages in this Symphony install as well as the
	 * forms for the creation/editing of a Page
	 */
	require_once(TOOLKIT . '/class.administrationpage.php');
	require_once(TOOLKIT . '/class.resourcemanager.php');
	require_once(TOOLKIT . '/class.xsltprocess.php');

	class contentBlueprintsPages extends AdministrationPage {

		public $_errors = array();
		protected $_hilights = array();

		public function insertBreadcrumbsUsingPageIdentifier($page_id, $preserve_last = true) {
			if($page_id == 0) {
				return parent::insertBreadcrumbs(
					array(Widget::Anchor(__('Pages'), SYMPHONY_URL . '/blueprints/pages/'))
				);
			}

			$pages = PageManager::resolvePage($page_id, 'handle');

			foreach($pages as &$page){
				// If we are viewing the Page Editor, the Breadcrumbs should link
				// to the parent's Page Editor.
				if($this->_context[0] == 'edit') {
					$page = Widget::Anchor(
						PageManager::fetchTitleFromHandle($page),
						SYMPHONY_URL . '/blueprints/pages/edit/' . PageManager::fetchIDFromHandle($page) . '/'
					);
				}

				// If the pages index is nested, the Breadcrumb should link to the
				// Pages Index filtered by parent
				else if(Symphony::Configuration()->get('pages_table_nest_children', 'symphony') == 'yes') {
					$page = Widget::Anchor(
						PageManager::fetchTitleFromHandle($page),
						SYMPHONY_URL . '/blueprints/pages/?parent=' . PageManager::fetchIDFromHandle($page)
					);
				}

				// If there is no nesting on the Pages Index, the breadcrumb is
				// not a link, just plain text
				else {
					$page = new XMLElement('span', PageManager::fetchTitleFromHandle($page));
				}
			}

			if(!$preserve_last) array_pop($pages);

			parent::insertBreadcrumbs(array_merge(
				array(Widget::Anchor(__('Pages'), SYMPHONY_URL . '/blueprints/pages/')),
				$pages
			));
		}

		public function listAllPages($separator = '/') {
			$pages = PageManager::fetch(false, array('id', 'handle', 'title', 'path'));

			foreach($pages as &$page){
				$parents = explode('/', $page['path']);

				foreach($parents as &$parent){
					$parent = PageManager::fetchTitleFromHandle($parent);
				}

				$parents = implode($separator, $parents);
				$page['title'] = ($parents ? $parents . $separator . $page['title'] : $page['title']);
			}

			return $pages;
		}

		public function __viewIndex() {
			$this->setPageType('table');
			$this->setTitle(__('%1$s &ndash; %2$s', array(__('Pages'), __('Symphony'))));

			$nesting = (Symphony::Configuration()->get('pages_table_nest_children', 'symphony') == 'yes');

			if($nesting == true && isset($_GET['parent']) && is_numeric($_GET['parent'])) {
				$parent = PageManager::fetchPageByID((int)$_GET['parent'], array('title', 'id'));
			}

			$this->appendSubheading(isset($parent) ? $parent['title'] : __('Pages'), Widget::Anchor(
				__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/' . ($nesting == true && isset($parent) ? "?parent={$parent['id']}" : NULL),
				__('Create a new page'), 'create button', NULL, array('accesskey' => 'c')
			));

			if(isset($parent)) {
				$this->insertBreadcrumbsUsingPageIdentifier($parent['id'], false);
			}

			$aTableHead = array(
				array(__('Title'), 'col'),
				array(__('Template'), 'col'),
				array('<acronym title="' . __('Universal Resource Locator') . '">' . __('URL') . '</acronym>', 'col'),
				array('<acronym title="' . __('Universal Resource Locator') . '">' . __('URL') . '</acronym> ' . __('Parameters'), 'col'),
				array(__('Type'), 'col')
			);
			$aTableBody = array();

			if($nesting == true){
				$aTableHead[] = array(__('Children'), 'col');
				$where = array(
					'parent ' . (isset($parent) ? " = {$parent['id']} " : ' IS NULL ')
				);
			}
			else {
				$where = array();<commit_msg>Changing acronym to abbr<commit_after><?php

	/**
	 * @package content
	 */

	/**
	 * Developers can create new Frontend pages from this class. It provides
	 * an index view of all the pages in this Symphony install as well as the
	 * forms for the creation/editing of a Page
	 */
	require_once(TOOLKIT . '/class.administrationpage.php');
	require_once(TOOLKIT . '/class.resourcemanager.php');
	require_once(TOOLKIT . '/class.xsltprocess.php');

	class contentBlueprintsPages extends AdministrationPage {

		public $_errors = array();
		protected $_hilights = array();

		public function insertBreadcrumbsUsingPageIdentifier($page_id, $preserve_last = true) {
			if($page_id == 0) {
				return parent::insertBreadcrumbs(
					array(Widget::Anchor(__('Pages'), SYMPHONY_URL . '/blueprints/pages/'))
				);
			}

			$pages = PageManager::resolvePage($page_id, 'handle');

			foreach($pages as &$page){
				// If we are viewing the Page Editor, the Breadcrumbs should link
				// to the parent's Page Editor.
				if($this->_context[0] == 'edit') {
					$page = Widget::Anchor(
						PageManager::fetchTitleFromHandle($page),
						SYMPHONY_URL . '/blueprints/pages/edit/' . PageManager::fetchIDFromHandle($page) . '/'
					);
				}

				// If the pages index is nested, the Breadcrumb should link to the
				// Pages Index filtered by parent
				else if(Symphony::Configuration()->get('pages_table_nest_children', 'symphony') == 'yes') {
					$page = Widget::Anchor(
						PageManager::fetchTitleFromHandle($page),
						SYMPHONY_URL . '/blueprints/pages/?parent=' . PageManager::fetchIDFromHandle($page)
					);
				}

				// If there is no nesting on the Pages Index, the breadcrumb is
				// not a link, just plain text
				else {
					$page = new XMLElement('span', PageManager::fetchTitleFromHandle($page));
				}
			}

			if(!$preserve_last) array_pop($pages);

			parent::insertBreadcrumbs(array_merge(
				array(Widget::Anchor(__('Pages'), SYMPHONY_URL . '/blueprints/pages/')),
				$pages
			));
		}

		public function listAllPages($separator = '/') {
			$pages = PageManager::fetch(false, array('id', 'handle', 'title', 'path'));

			foreach($pages as &$page){
				$parents = explode('/', $page['path']);

				foreach($parents as &$parent){
					$parent = PageManager::fetchTitleFromHandle($parent);
				}

				$parents = implode($separator, $parents);
				$page['title'] = ($parents ? $parents . $separator . $page['title'] : $page['title']);
			}

			return $pages;
		}

		public function __viewIndex() {
			$this->setPageType('table');
			$this->setTitle(__('%1$s &ndash; %2$s', array(__('Pages'), __('Symphony'))));

			$nesting = (Symphony::Configuration()->get('pages_table_nest_children', 'symphony') == 'yes');

			if($nesting == true && isset($_GET['parent']) && is_numeric($_GET['parent'])) {
				$parent = PageManager::fetchPageByID((int)$_GET['parent'], array('title', 'id'));
			}

			$this->appendSubheading(isset($parent) ? $parent['title'] : __('Pages'), Widget::Anchor(
				__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/' . ($nesting == true && isset($parent) ? "?parent={$parent['id']}" : NULL),
				__('Create a new page'), 'create button', NULL, array('accesskey' => 'c')
			));

			if(isset($parent)) {
				$this->insertBreadcrumbsUsingPageIdentifier($parent['id'], false);
			}

			$aTableHead = array(
				array(__('Title'), 'col'),
				array(__('Template'), 'col'),
				array('<abbr title="' . __('Universal Resource Locator') . '">' . __('URL') . '</abbr>', 'col'),
				array('<abbr title="' . __('Universal Resource Locator') . '">' . __('URL') . '</abbr> ' . __('Parameters'), 'col'),
				array(__('Type'), 'col')
			);
			$aTableBody = array();

			if($nesting == true){
				$aTableHead[] = array(__('Children'), 'col');
				$where = array(
					'parent ' . (isset($parent) ? " = {$parent['id']} " : ' IS NULL ')
				);
			}
			else {
				$where = array();
{'fraction_non_alphanumeric': 0.19088937093275488, 'fraction_numerical': 0.0010207987750414699, 'mean_word_length': 3.8743781094527363, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4219989', 'n_tokens_mistral': 2972, 'n_tokens_neox': 2447, 'n_words': 542}