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

$template = Smr\Template::getInstance();
$session = Smr\Session::getInstance();
$account = $session->getAccount();

$template->assign('PageTopic', 'Viewing Reported Messages');

$container = Page::create('admin/notify_delete_processing.php');
$template->assign('DeleteHREF', $container->href());

$db = Smr\Database::getInstance();
$dbResult = $db->read('SELECT * FROM message_notify');
$messages = [];
foreach ($dbResult->records() as $dbRecord) {
	$gameID = $dbRecord->getInt('game_id');
	$sender = Smr\Messages::getMessagePlayer($dbRecord->getInt('from_id'), $gameID);
	$receiver = Smr\Messages::getMessagePlayer($dbRecord->getInt('to_id'), $gameID);

	$container = Page::create('admin/notify_reply.php');
	$container['offender'] = $dbRecord->getInt('from_id');
	$container['offended'] = $dbRecord->getInt('to_id');
	$container['game_id'] = $gameID;

	$getName = function(SmrPlayer|string $messagePlayer) use ($container, $account): string {
		$name = $messagePlayer;
		if ($messagePlayer instanceof SmrPlayer) {
			$name = $messagePlayer->getAccount()->getLogin();
			$name .= ' (' . $messagePlayer->getAccountID() . ')';
			$name .= ' a.k.a ' . $messagePlayer->getDisplayName();
		}
		// If we can send admin messages, make the names reply links
		if ($account->hasPermission(PERMISSION_SEND_ADMIN_MESSAGE)) {
			$name = create_link($container, $name);
		}
		return $name;
	};

	if (!SmrGame::gameExists($gameID)) {
		$gameName = 'Game ' . $gameID . ' no longer exists';
	} else {
		$gameName = SmrGame::getGame($gameID)->getDisplayName();
	}

	$messages[] = [
		'notifyID' => $dbRecord->getInt('notify_id'),
		'senderName' => $getName($sender),
		'receiverName' => $getName($receiver),
		'gameName' => $gameName,
		'sentDate' => date($account->getDateTimeFormat(), $dbRecord->getInt('sent_time')),<commit_msg>notify_view.php: be more careful about type mutation<commit_after><?php declare(strict_types=1);

$template = Smr\Template::getInstance();
$session = Smr\Session::getInstance();
$account = $session->getAccount();

$template->assign('PageTopic', 'Viewing Reported Messages');

$container = Page::create('admin/notify_delete_processing.php');
$template->assign('DeleteHREF', $container->href());

$db = Smr\Database::getInstance();
$dbResult = $db->read('SELECT * FROM message_notify');
$messages = [];
foreach ($dbResult->records() as $dbRecord) {
	$gameID = $dbRecord->getInt('game_id');
	$sender = Smr\Messages::getMessagePlayer($dbRecord->getInt('from_id'), $gameID);
	$receiver = Smr\Messages::getMessagePlayer($dbRecord->getInt('to_id'), $gameID);

	$container = Page::create('admin/notify_reply.php');
	$container['offender'] = $dbRecord->getInt('from_id');
	$container['offended'] = $dbRecord->getInt('to_id');
	$container['game_id'] = $gameID;

	$getName = function(SmrPlayer|string $messagePlayer) use ($container, $account): string {
		if ($messagePlayer instanceof SmrPlayer) {
			$name = $messagePlayer->getAccount()->getLogin();
			$name .= ' (' . $messagePlayer->getAccountID() . ')';
			$name .= ' a.k.a ' . $messagePlayer->getDisplayName();
		} else {
			$name = $messagePlayer;
		}
		// If we can send admin messages, make the names reply links
		if ($account->hasPermission(PERMISSION_SEND_ADMIN_MESSAGE)) {
			$name = create_link($container, $name);
		}
		return $name;
	};

	if (!SmrGame::gameExists($gameID)) {
		$gameName = 'Game ' . $gameID . ' no longer exists';
	} else {
		$gameName = SmrGame::getGame($gameID)->getDisplayName();
	}

	$messages[] = [
		'notifyID' => $dbRecord->getInt('notify_id'),
		'senderName' => $getName($sender),
		'receiverName' => $getName($receiver),
		'gameName' => $gameName,
		'sentDate' => date($account->getDateTimeFormat(), $dbRecord->getInt('sent_time')),
{'fraction_non_alphanumeric': 0.20079470198675498, 'fraction_numerical': 0.0005298013245033113, 'mean_word_length': 6.097744360902255, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '4810880', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1242, 'n_words': 214}