<commit_before><?php declare(strict_types=1);

$template = Smr\Template::getInstance();
$db = Smr\Database::getInstance();
$session = Smr\Session::getInstance();
$var = $session->getCurrentVar();
$player = $session->getPlayer();

$template->assign('PageTopic', 'Viewing Articles');
Menu::galacticPost();

if (isset($var['news'])) {
	$db->insert('news', [
		'game_id' => $db->escapeNumber($player->getGameID()),
		'time' => $db->escapeNumber(Smr\Epoch::time()),
		'news_message' => $db->escapeString($var['news']),
		'type' => $db->escapeString('breaking'),
	]);
	// avoid multiple insertion on ajax updates
	unset($var['news']);
	$var['added_to_breaking_news'] = true;
}

// Get the articles that are not already in a paper
$articles = [];
$dbResult = $db->read('SELECT * FROM galactic_post_article WHERE article_id NOT IN (SELECT article_id FROM galactic_post_paper_content) AND game_id = ' . $db->escapeNumber($player->getGameID()));
foreach ($dbResult->records() as $dbRecord) {
	$title = $dbRecord->getString('title');
	$writer = SmrPlayer::getPlayer($dbRecord->getInt('writer_id'), $player->getGameID());
	$container = Page::create('galactic_post_view_article.php');
	$container['id'] = $dbRecord->getInt('article_id');
	$articles[] = [
		'title' => $title,
		'writer' => $writer->getDisplayName(),
		'link' => $container->href(),
	];
}
$template->assign('Articles', $articles);

// Details about a selected article
if (isset($var['id'])) {
	$dbResult = $db->read('SELECT * FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND article_id = ' . $db->escapeNumber($var['id']));
	$dbRecord = $dbResult->record();

	$container = Page::create('galactic_post_write_article.php');<commit_msg>galactic_post_view_article.php: fix hidden articles<commit_after><?php declare(strict_types=1);

$template = Smr\Template::getInstance();
$db = Smr\Database::getInstance();
$session = Smr\Session::getInstance();
$var = $session->getCurrentVar();
$player = $session->getPlayer();

$template->assign('PageTopic', 'Viewing Articles');
Menu::galacticPost();

if (isset($var['news'])) {
	$db->insert('news', [
		'game_id' => $db->escapeNumber($player->getGameID()),
		'time' => $db->escapeNumber(Smr\Epoch::time()),
		'news_message' => $db->escapeString($var['news']),
		'type' => $db->escapeString('breaking'),
	]);
	// avoid multiple insertion on ajax updates
	unset($var['news']);
	$var['added_to_breaking_news'] = true;
}

// Get the articles that are not already in a paper
$articles = [];
$dbResult = $db->read('SELECT * FROM galactic_post_article WHERE article_id NOT IN (SELECT article_id FROM galactic_post_paper_content WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ') AND game_id = ' . $db->escapeNumber($player->getGameID()));
foreach ($dbResult->records() as $dbRecord) {
	$title = $dbRecord->getString('title');
	$writer = SmrPlayer::getPlayer($dbRecord->getInt('writer_id'), $player->getGameID());
	$container = Page::create('galactic_post_view_article.php');
	$container['id'] = $dbRecord->getInt('article_id');
	$articles[] = [
		'title' => $title,
		'writer' => $writer->getDisplayName(),
		'link' => $container->href(),
	];
}
$template->assign('Articles', $articles);

// Details about a selected article
if (isset($var['id'])) {
	$dbResult = $db->read('SELECT * FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND article_id = ' . $db->escapeNumber($var['id']));
	$dbRecord = $dbResult->record();

	$container = Page::create('galactic_post_write_article.php');
{'fraction_non_alphanumeric': 0.21116096466629278, 'fraction_numerical': 0.0005608524957936063, 'mean_word_length': 6.54122621564482, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 69, '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': '3864526', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1159, 'n_words': 215}