<commit_before><?php
require_once('db-connect.inc.php');
$db = getDatabasePDO();

$lastmessage = $_POST['lastmessage'];

$stmt = $db->prepare('SELECT MessageId FROM Messages WHERE MessageId > :lastmessage');
$stmt->execute(array(':lastmessage' => $lastmessage));

$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rowCount = count($rows);

if($rowCount > 1) {
	$rownumber = $rowCount > 1 ? $rows[$rowCount - 1]['MessageId'] : $rows[1]['MessageId'];
	$send = array('result' => true, 'rownumber' => $rownumber);<commit_msg>Fix the check for messages PHP, which was returning false if there was only one record found.<commit_after><?php
require_once('db-connect.inc.php');
$db = getDatabasePDO();

$lastmessage = $_POST['lastmessage'];

$stmt = $db->prepare('SELECT MessageId FROM Messages WHERE MessageId > :lastmessage');
$stmt->execute(array(':lastmessage' => $lastmessage));

$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rowCount = count($rows);

if($rowCount > 0) {
	$rownumber = $rowCount > 1 ? $rows[$rowCount - 1]['MessageId'] : $rows[0]['MessageId'];
	$send = array('result' => true, 'rownumber' => $rownumber);
{'fraction_non_alphanumeric': 0.2018018018018018, 'fraction_numerical': 0.007207207207207207, 'mean_word_length': 6.823943661971831, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '1106555', 'n_tokens_mistral': 378, 'n_tokens_neox': 371, 'n_words': 81}