<commit_before><?php

class Post {
	public $source;
	public $link;
	public $time;

	private $date;
	private $title;
	private $body;

	function __construct ($filename) {
		$this->source = SOURCE_DIR . $filename;
		$this->link = OUTPUT_DIR . substr($filename, 0, -4) . '.html';
		$this->time = filemtime('../' . $this->source);
		$this->date = strtotime(substr($filename, 0, 8));
		$this->setTitle();
	}

	private function setTitle () {
		$file = fopen('../' . $this->source, 'r');
		$rawTitle = fgets($file);
		fclose($file);
		$this->title = trim($rawTitle, " \t\n\r\0#");
	}

	public function setBody () {
		if (isset($this->body))
			return;
		$rawContents = file_get_contents('../' . $this->source);
		$start = strpos($rawContents, "\n");
		$rawContents = trim(substr($rawContents, $start), " \t\n\r\0-=");
		$this->body = markdown($rawContents);
	}

	public function process ($template, $type) {
		if ($type == 'output')
			$date = date(OUTPUT_DATE_FORMAT, $this->date);
		else if ($type == 'index')
			$date = date(INDEX_DATE_FORMAT, $this->date);
		else if ($type == 'archive')
			$date = date(ARCHIVE_DATE_FORMAT, $this->date);
		else if ($type == 'rss')
			$date = date('D, d M Y H:i:s T', $this->date);
		else {
			echo "<p class=\"error\">A fatal error occurred</p>\n";
			include 'footer.php';
			exit;
		}

		$search = array('[title]', '[date]', '[body]', '[link]');
		$replace = array($this->title, $date, $this->body, $this->link);
		return str_replace($search, $replace, $template);
	}
}<commit_msg>undo last commit (UTC isn't valid RFC822)<commit_after><?php

class Post {
	public $source;
	public $link;
	public $time;

	private $date;
	private $title;
	private $body;

	function __construct ($filename) {
		$this->source = SOURCE_DIR . $filename;
		$this->link = OUTPUT_DIR . substr($filename, 0, -4) . '.html';
		$this->time = filemtime('../' . $this->source);
		$this->date = strtotime(substr($filename, 0, 8));
		$this->setTitle();
	}

	private function setTitle () {
		$file = fopen('../' . $this->source, 'r');
		$rawTitle = fgets($file);
		fclose($file);
		$this->title = trim($rawTitle, " \t\n\r\0#");
	}

	public function setBody () {
		if (isset($this->body))
			return;
		$rawContents = file_get_contents('../' . $this->source);
		$start = strpos($rawContents, "\n");
		$rawContents = trim(substr($rawContents, $start), " \t\n\r\0-=");
		$this->body = markdown($rawContents);
	}

	public function process ($template, $type) {
		if ($type == 'output')
			$date = date(OUTPUT_DATE_FORMAT, $this->date);
		else if ($type == 'index')
			$date = date(INDEX_DATE_FORMAT, $this->date);
		else if ($type == 'archive')
			$date = date(ARCHIVE_DATE_FORMAT, $this->date);
		else if ($type == 'rss')
			$date = date('D, d M Y H:i:s O', $this->date);
		else {
			echo "<p class=\"error\">A fatal error occurred</p>\n";
			include 'footer.php';
			exit;
		}

		$search = array('[title]', '[date]', '[body]', '[link]');
		$replace = array($this->title, $date, $this->body, $this->link);
		return str_replace($search, $replace, $template);
	}
}
{'fraction_non_alphanumeric': 0.22218586387434555, 'fraction_numerical': 0.004908376963350785, 'mean_word_length': 3.875598086124402, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 43, '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': '4016485', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1119, 'n_words': 260}