<commit_before><?php
set_include_path($_SERVER['DOCUMENT_ROOT']);
require_once('resources/scripts/engine.php');
$page = new Page;
$page->setTitle('Home');
$page->startBody();
?>
<div class="jumbotron">
	<h1>MCF Modlist</h1>
	<p>A list of Minecraft mods compiled by the community</p>
	<p>
		<a href="/version/latest" class="btn btn-primary btn-lg">Check out the latest mod list!</a>
		<a href="/history" class="btn btn-default btn-lg">What happened to the site?</a>
	</p>
</div>
<div class="row">
	<div class="col-sm-6 col-lg-3">
		<h2>1.6.4</h2>
		<p><i>Last Updated 30th September, 2013</i></p>
		<p><?php echo changelogParse('1.6.4') ?></p>
		<p><a class="btn btn-primary" href="/version/1.6.4">View list &raquo;</a> <a class="btn btn-default" href="/changelog/1.6.4">View all changes &raquo;</a></p>
	</div>
	<div class="col-sm-6 col-lg-3">
		<h2>1.6.2</h2>
		<p><i>Last Updated 24th September, 2013</i></p>
		<p><?php echo changelogParse('1.6.2') ?></p>
		<p><a class="btn btn-primary" href="/version/1.6.2">View list &raquo;</a> <a class="btn btn-default" href="/changelog/1.6.2">View all changes &raquo;</a></p>
	</div>
	<div class="col-sm-6 col-lg-3">
		<h2>1.6.1</h2>
		<p><i>Last Updated 10th September, 2013</i></p>
		<p><?php echo changelogParse('1.6.1') ?></p>
		<p><a class="btn btn-primary" href="/version/1.6.1">View list &raquo;</a> <a class="btn btn-default" href="/changelog/1.6.1">View all changes &raquo;</a></p>
	</div>
	<div class="col-sm-6 col-lg-3">
		<h2>1.5.2</h2>
		<p><i>Last Updated 24th September, 2013</i></p>
		<p><?php echo changelogParse('1.5.2') ?></p>
		<p><a class="btn btn-primary" href="/version/1.5.2">View list &raquo;</a> <a class="btn btn-default" href="/changelog/1.5.2">View all changes &raquo;</a></p>
	</div>
</div>
<?php
$page->endBody();
echo $page->render('resources/templates/modlist-template.php');

function changelogDate($version) {
	$file = file('resources/data/changelogs/'.$version.'.txt');
	return substr(trim($file[0]),1,-1);
}

function changelogParse($version) {
	$file = file('resources/data/changelogs/'.$version.'.txt');
	$latestchanges = array();
	for($i=1;$i<count($file);$i++) {
		if($file[$i] == "\r\n" || $file[$i] == "\n")
			break;<commit_msg>Fixed homepage dates not working properly<commit_after><?php
set_include_path($_SERVER['DOCUMENT_ROOT']);
require_once('resources/scripts/engine.php');
date_default_timezone_set('UTC');
$page = new Page;
$page->setTitle('Home');
$page->startBody();
?>
<div class="jumbotron">
	<h1>MCF Modlist</h1>
	<p>A list of Minecraft mods compiled by the community</p>
	<p>
		<a href="/version/latest" class="btn btn-primary btn-lg">Check out the latest mod list!</a>
		<a href="/history" class="btn btn-default btn-lg">What happened to the site?</a>
	</p>
</div>
<div class="row">
	<div class="col-sm-6 col-lg-3">
		<h2>1.6.4</h2>
		<p><i>Last Updated <?php echo changelogDate('1.6.4') ?></i></p>
		<p><?php echo changelogParse('1.6.4') ?></p>
		<p><a class="btn btn-primary" href="/version/1.6.4">View list &raquo;</a> <a class="btn btn-default" href="/changelog/1.6.4">View all changes &raquo;</a></p>
	</div>
	<div class="col-sm-6 col-lg-3">
		<h2>1.6.2</h2>
		<p><i>Last Updated <?php echo changelogDate('1.6.2') ?></i></p>
		<p><?php echo changelogParse('1.6.2') ?></p>
		<p><a class="btn btn-primary" href="/version/1.6.2">View list &raquo;</a> <a class="btn btn-default" href="/changelog/1.6.2">View all changes &raquo;</a></p>
	</div>
	<div class="col-sm-6 col-lg-3">
		<h2>1.6.1</h2>
		<p><i>Last Updated <?php echo changelogDate('1.6.1') ?></i></p>
		<p><?php echo changelogParse('1.6.1') ?></p>
		<p><a class="btn btn-primary" href="/version/1.6.1">View list &raquo;</a> <a class="btn btn-default" href="/changelog/1.6.1">View all changes &raquo;</a></p>
	</div>
	<div class="col-sm-6 col-lg-3">
		<h2>1.5.2</h2>
		<p><i>Last Updated <?php echo changelogDate('1.5.2') ?></i></p>
		<p><?php echo changelogParse('1.5.2') ?></p>
		<p><a class="btn btn-primary" href="/version/1.5.2">View list &raquo;</a> <a class="btn btn-default" href="/changelog/1.5.2">View all changes &raquo;</a></p>
	</div>
</div>
<?php
$page->endBody();
echo $page->render('resources/templates/modlist-template.php');

function changelogDate($version) {
	$file = file('resources/data/changelogs/'.$version.'.txt');
	$date = substr(trim($file[0]),1,-1);
	$date = parseDate($date);
	return date('jS F, Y',$date);
}

function parseDate($date) {
	$pieces = explode('/',$date);
	return strtotime(implode(' ',$pieces));
}

function changelogParse($version) {
	$file = file('resources/data/changelogs/'.$version.'.txt');
	$latestchanges = array();
	for($i=1;$i<count($file);$i++) {
		if($file[$i] == "\r\n" || $file[$i] == "\n")
			break;
{'fraction_non_alphanumeric': 0.2555131467345208, 'fraction_numerical': 0.037319762510602206, 'mean_word_length': 4.703748488512696, 'pattern_counts': {'":': 0, '<': 177, '<?xml version=': 0, '>': 181, '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': '5639529', 'n_tokens_mistral': 2023, 'n_tokens_neox': 1960, 'n_words': 374}