<commit_before><?php

/**
 * Override default reports to provide columns and filters that help the user identify which site the 
 * report or page being reported on is associated with
 * @package multisites
 * @author <EMAIL>
 **/
class MultisitesReport extends Extension{

	public function updateCMSFields(FieldList $fields){
		$gfc = $fields->fieldByName('Report')->getConfig();
		$columns = $this->owner->columns();
		$exportColumns = array();
		foreach ($columns as $k => $v) {
			$exportColumns[$k] = $v['title'];
		}
		$gfc->getComponentByType('GridFieldExportButton')->setExportColumns($exportColumns);
	}

	public static function getMultisitesReportColumns(){
		return array(
			"Title" => array(
				"title" => "Title", 
				"link" => true,
			),
			"Site.Title" => array(
				"title" => "Site"
			),
			"AbsoluteLink" => array(
				"title" => "URL",
				"link" => true
			)
		);
	}

	public static function getSiteParameterField(){
		$source = Site::get()->map('ID', 'Title')->toArray();
		$source = array('0' => 'All') + $source; // works around ajax bug
		return DropdownField::create('Site', 'Site', $source)->setHasEmptyDefault(false);
	}
}

class Multisites_SideReport_EmptyPages extends SideReport_EmptyPages{
	public function columns() {
		return MultisitesReport::getMultisitesReportColumns();
	}

	public function parameterFields() {
		$fields = FieldList::create();
		$fields->push(MultisitesReport::getSiteParameterField());
		return $fields;
	}


	public function sourceRecords($params = null) {
		$records = parent::sourceRecords($params);
		$site = isset($params['Site']) ? (int)$params['Site'] : 0;
		if($site > 0){
			$records = $records->filter('SiteID', $site);
		}
		return $records;
	}
}

class Multisites_BrokenLinksReport extends BrokenLinksReport{
	public function columns() {
		return MultisitesReport::getMultisitesReportColumns();
	}<commit_msg>Correcting the display fields for the broken links report, making sure the "problem" was coming through.<commit_after><?php

/**
 * Override default reports to provide columns and filters that help the user identify which site the 
 * report or page being reported on is associated with
 * @package multisites
 * @author <EMAIL>
 **/
class MultisitesReport extends Extension{

	public function updateCMSFields(FieldList $fields){
		$gfc = $fields->fieldByName('Report')->getConfig();
		$columns = $this->owner->columns();
		$exportColumns = array();
		foreach ($columns as $k => $v) {
			$exportColumns[$k] = $v['title'];
		}
		$gfc->getComponentByType('GridFieldExportButton')->setExportColumns($exportColumns);
	}

	public static function getMultisitesReportColumns(){
		return array(
			"Title" => array(
				"title" => "Title", 
				"link" => true,
			),
			"Site.Title" => array(
				"title" => "Site"
			),
			"AbsoluteLink" => array(
				"title" => "URL",
				"link" => true
			)
		);
	}

	public static function getSiteParameterField(){
		$source = Site::get()->map('ID', 'Title')->toArray();
		$source = array('0' => 'All') + $source; // works around ajax bug
		return DropdownField::create('Site', 'Site', $source)->setHasEmptyDefault(false);
	}
}

class Multisites_SideReport_EmptyPages extends SideReport_EmptyPages{
	public function columns() {
		return MultisitesReport::getMultisitesReportColumns();
	}

	public function parameterFields() {
		$fields = FieldList::create();
		$fields->push(MultisitesReport::getSiteParameterField());
		return $fields;
	}


	public function sourceRecords($params = null) {
		$records = parent::sourceRecords($params);
		$site = isset($params['Site']) ? (int)$params['Site'] : 0;
		if($site > 0){
			$records = $records->filter('SiteID', $site);
		}
		return $records;
	}
}

class Multisites_BrokenLinksReport extends BrokenLinksReport{
	public function columns() {
		return MultisitesReport::getMultisitesReportColumns() + parent::columns();
	}
{'fraction_non_alphanumeric': 0.15569326103795508, 'fraction_numerical': 0.001549186676994578, 'mean_word_length': 4.896499238964992, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 49, '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': '6628896', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1151, 'n_words': 288}