<commit_before><?php
require 'Parsedown.php';
require 'helpers.php';
?>
<html>
<head>

<?php
// Set title of post to <title> if possible
if(isset($_GET['entry'])) {
	$entry = $_GET['entry'];
	$filename = file_from_url($entry, $path_to_txts);
	echo '<title>' . get_title($filename) . ' - lambdan.se</title>';
} else {
	echo '<title>lambdan.se</title>';
}
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="http://lambdan.se/css.css">
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://lambdan.se/rss.php" />

<meta charset="utf-8">

</head>

<body>
	<div class="navigation">
	
	<p><a href="." class="logo">lambdan.se</a> • <a href="archive.php">Archive</a> • <a href="stats.php">Stats</a> • <a href="rss.php">RSS</a> • <a href="https://twitter.com/djs__">Twitter</a></p>


<?php
// Add files to array, and natsort it, and reverse it (newest first)
$files = glob('' . $path_to_txts . '*.{txt,md,markdown}', GLOB_BRACE);
natsort($files);
$files = array_reverse($files, false);
?>

</div>
<?php

// Maybe show one?
if(isset($_GET['entry'])) {
	$entry = $_GET['entry'];
} else {
	$entry = count($files); // latest entry if nothing is requested
}

$filename = file_from_url($entry, $path_to_txts);

echo '<h1 class="article_title">' . get_title($filename) . '</h1>';
echo '<h2 class="article_date"><a href="?entry=' . get_display_filename($filename) . '">' . get_date($filename, "j M Y H:m") . '</a></h2>';
echo '<div class="article">';
$Parsedown = new Parsedown();
echo $Parsedown->text(get_text($filename));
echo '</div>';
// Navigation between posts
echo '<footer><ul>';

echo '<li><a href="stats.php?entry=' . get_display_filename($filename) . '">Stats For This Post</a></li>';

$curr = get_number($filename);
$prev = file_from_url($curr - 1, $path_to_txts);
$next = file_from_url($curr + 1, $path_to_txts);

if (file_exists($next)) {
	print '<li>Next: <a href="?entry=' . get_display_filename($next) . '">' . get_title($next) . '</a>';
}

if (file_exists($prev)) {
	print '<li>Previous: <a href="?entry=' . get_display_filename($prev) . '">' . get_title($prev) . '</a>';
}

echo '<li><a href="archive.php">Archive</a>';

echo '</ul></footer>';<commit_msg>error when blog posts not found<commit_after><?php
require 'Parsedown.php';
require 'helpers.php';
?>
<html>
<head>

<?php
// Set title of post to <title> if possible
if(isset($_GET['entry'])) {
	$entry = $_GET['entry'];
	$filename = file_from_url($entry, $path_to_txts);
	echo '<title>' . get_title($filename) . ' - lambdan.se</title>';
} else {
	echo '<title>lambdan.se</title>';
}
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="http://lambdan.se/css.css">
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://lambdan.se/rss.php" />

<meta charset="utf-8">

</head>

<body>
	<div class="navigation">
	
	<p><a href="." class="logo">lambdan.se</a> • <a href="archive.php">Archive</a> • <a href="stats.php">Stats</a> • <a href="rss.php">RSS</a> • <a href="https://twitter.com/djs__">Twitter</a></p>


<?php
// Add files to array, and natsort it, and reverse it (newest first)
$files = glob('' . $path_to_txts . '*.{txt,md,markdown}', GLOB_BRACE);
natsort($files);
$files = array_reverse($files, false);
?>

</div>
<?php

// Maybe show one?
if(isset($_GET['entry'])) {
	$entry = $_GET['entry'];
} else {
	$entry = count($files); // latest entry if nothing is requested
}

$filename = file_from_url($entry, $path_to_txts);
if (file_exists($filename)) {
	echo '<h1 class="article_title">' . get_title($filename) . '</h1>';
	echo '<h2 class="article_date"><a href="?entry=' . get_display_filename($filename) . '">' . get_date($filename, "j M Y H:m") . '</a></h2>';
	echo '<div class="article">';
	$Parsedown = new Parsedown();
	echo $Parsedown->text(get_text($filename));
	echo '</div>';
	// Navigation between posts
	echo '<footer><ul>';

	echo '<li><a href="stats.php?entry=' . get_display_filename($filename) . '">Stats For This Post</a></li>';

	$curr = get_number($filename);
	$prev = file_from_url($curr - 1, $path_to_txts);
	$next = file_from_url($curr + 1, $path_to_txts);

	if (file_exists($next)) {
		print '<li>Next: <a href="?entry=' . get_display_filename($next) . '">' . get_title($next) . '</a>';
	}

	if (file_exists($prev)) {
		print '<li>Previous: <a href="?entry=' . get_display_filename($prev) . '">' . get_title($prev) . '</a>';
	}
} else {
	echo '<h3>Not found</h3>';
	echo '<p>The post you wanted to see was not found. It has probably been removed or you changed the entry value in the URL to be invalid.</p>';
	echo '<footer><ul>';
}

echo '<li><a href="archive.php">Archive</a>';

echo '</ul></footer>';
{'fraction_non_alphanumeric': 0.2341319882303489, 'fraction_numerical': 0.0037831021437578815, 'mean_word_length': 5.204693611473273, 'pattern_counts': {'":': 0, '<': 121, '<?xml version=': 0, '>': 121, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3242968', 'n_tokens_mistral': 1792, 'n_tokens_neox': 1769, 'n_words': 393}