<commit_before><?php global $SEARCHENGINE; header("Content-Type: text/xml"); print '<?xml version="1.0"?>'; ?>

<rss version="2.0" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
<channel>
<title>TheyWorkForYou.com Search: <?=$SEARCHENGINE->query_description_short() ?></title>
<link>http://www.theyworkforyou.com<?=htmlentities(str_replace('rss/', '', $_SERVER['REQUEST_URI'])) ?></link>
<description>Search results for <?=$SEARCHENGINE->query_description_short() ?> at TheyWorkForYou.com</description>
<language>en-gb</language>
<copyright>Parliamentary Copyright.</copyright>
<?php if (isset($data['info']['total_results'])) { ?>
<openSearch:totalResults><?=$data['info']['total_results'] ?></openSearch:totalResults>
<? }
	if (isset($data['info']['first_result'])) { ?>
<openSearch:startIndex><?=$data['info']['first_result'] ?></openSearch:startIndex>
<? }
	if (isset($data['info']['results_per_page'])) { ?>
<openSearch:itemsPerPage><?=$data['info']['results_per_page'] ?></openSearch:itemsPerPage>
<? }

global $this_page;
twfy_debug("TEMPLATE", "rss/hansard_search.php");

if (isset ($data['rows']) && count($data['rows']) > 0) {
	for ($i=0; $i<count($data['rows']); $i++) {
		$row = $data['rows'][$i];
		?>
<item>
<title><?
		if (isset($row['parent']) && count($row['parent']) > 0) {
			echo strip_tags($row['parent']['body']);
		}
		echo (' (' . format_date($row['hdate'], SHORTDATEFORMAT) . ')');
?></title>
<link>http://www.theyworkforyou.com<?=$row['listurl'] ?></link>
<description>
<?php
		if (isset($row['speaker']['first_name'])) {
			echo $row['speaker']['first_name'] . ' ' . $row['speaker']['last_name'] . ": ";
		} 
		echo str_replace(array('&#8212;', '<span class="hi">', '</span>'), array('-', '<b>', '</b>'), $row['body']) . "</description>\n</item>\n";
	}
}
?>
</channel>
</rss>

<commit_msg>Put HTML entities back to numbers for RSS feeds - presumably this is still broken if an entity occurs in the body.<commit_after><?php global $SEARCHENGINE; header("Content-Type: text/xml"); print '<?xml version="1.0"?>'; ?>

<rss version="2.0" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
<channel>
<title>TheyWorkForYou.com Search: <?=$SEARCHENGINE->query_description_short() ?></title>
<link>http://www.theyworkforyou.com<?=htmlentities(str_replace('rss/', '', $_SERVER['REQUEST_URI'])) ?></link>
<description>Search results for <?=$SEARCHENGINE->query_description_short() ?> at TheyWorkForYou.com</description>
<language>en-gb</language>
<copyright>Parliamentary Copyright.</copyright>
<?php if (isset($data['info']['total_results'])) { ?>
<openSearch:totalResults><?=$data['info']['total_results'] ?></openSearch:totalResults>
<? }
	if (isset($data['info']['first_result'])) { ?>
<openSearch:startIndex><?=$data['info']['first_result'] ?></openSearch:startIndex>
<? }
	if (isset($data['info']['results_per_page'])) { ?>
<openSearch:itemsPerPage><?=$data['info']['results_per_page'] ?></openSearch:itemsPerPage>
<? }

global $this_page;
twfy_debug("TEMPLATE", "rss/hansard_search.php");

if (isset ($data['rows']) && count($data['rows']) > 0) {
	for ($i=0; $i<count($data['rows']); $i++) {
		$row = $data['rows'][$i];
		?>
<item>
<title><?
		if (isset($row['parent']) && count($row['parent']) > 0) {
			echo strip_tags($row['parent']['body']);
		}
		echo (' (' . format_date($row['hdate'], SHORTDATEFORMAT) . ')');
?></title>
<link>http://www.theyworkforyou.com<?=$row['listurl'] ?></link>
<description>
<?php
		if (isset($row['speaker']['first_name'])) {
			$name = $row['speaker']['first_name'] . ' ' . $row['speaker']['last_name'];
			$name = str_replace(
				array('&Ouml;', '&uacute;', '&aacute;', '&iacute;', '&ocirc;'),
				array('&#214;', '&#250;', '&#225;', '&#237;', '&#244;'),
				$name
			); # XXX Can't have the entities in XML!

			echo $name . ': ';
		} 
		echo str_replace(array('&#8212;', '<span class="hi">', '</span>'), array('-', '<b>', '</b>'), $row['body']) . "</description>\n</item>\n";
	}
}
?>
</channel>
</rss>


{'fraction_non_alphanumeric': 0.27452948557089085, 'fraction_numerical': 0.010790464240903387, 'mean_word_length': 6.815686274509804, 'pattern_counts': {'":': 1, '<': 99, '<?xml version=': 2, '>': 105, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 6}, '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': '1888286', 'n_tokens_mistral': 1477, 'n_tokens_neox': 1418, 'n_words': 220}