<commit_before><?php
	$db_query = "
		SELECT
			count(`id`)
		FROM
			`spm_users`
		WHERE
			(now() - `lastOnline`) < " . $_SPM_CONF["BASE"]["ONLINE_TIME"] . "
		;
	";
	
	if (!$db_count = $db->query($db_query))
		die(header('location: index.php?service=error&err=db_error'));
	
	$db_query = "
		SELECT
			`id`,
			`secondname`,
			`firstname`,
			`username`
		FROM
			`spm_users`
		WHERE
		(
			`teacherId` = '" . $_SESSION['uid'] . "'
		OR
			`teacherId` = '" . $_SESSION['teacherId'] . "'
		OR
			`id` = '" . $_SESSION['teacherId'] . "'
		OR
			`id` = '" . $_SESSION['teacherId'] . "'
		)
		AND
			(now() - `lastOnline`) < " . $_SPM_CONF["BASE"]["ONLINE_TIME"] . "
		ORDER BY
			`lastOnline` DESC
		LIMIT
			0, 30
		;
	";
	
	if (!$db_result = $db->query($db_query))
			die(header('location: index.php?service=error&err=db_error'));<commit_msg>Мелкие улучшения SQL запроса N2<commit_after><?php
	$db_query = "
		SELECT
			count(`id`)
		FROM
			`spm_users`
		WHERE
			(now() - `lastOnline`) < " . $_SPM_CONF["BASE"]["ONLINE_TIME"] . "
		;
	";
	
	if (!$db_count = $db->query($db_query))
		die(header('location: index.php?service=error&err=db_error'));
	
	$db_query = "
		SELECT
			`id`,
			`secondname`,
			`firstname`,
			`username`
		FROM
			`spm_users`
		WHERE
		(
			`teacherId` = '" . $_SESSION['uid'] . "'
		OR
			`teacherId` = '" . $_SESSION['teacherId'] . "'
		OR
			`id` = '" . $_SESSION['teacherId'] . "'
		OR
			`id` = '" . $_SESSION['teacherId'] . "'
		)
		AND
			(now() - `lastOnline`) < " . $_SPM_CONF["BASE"]["ONLINE_TIME"] . "
		ORDER BY
			`lastOnline` DESC,
			`secondname` ASC,
			`firstname` ASC
		LIMIT
			0, 30
		;
	";
	
	if (!$db_result = $db->query($db_query))
			die(header('location: index.php?service=error&err=db_error'));
{'fraction_non_alphanumeric': 0.21726700971983992, 'fraction_numerical': 0.004002287021154946, 'mean_word_length': 3.098360655737705, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '5593489', 'n_tokens_mistral': 843, 'n_tokens_neox': 728, 'n_words': 109}