$dt[0], 'chatIcon' => $chat_info -> author -> imageUrl, 'chatName' => htmlspecialchars ($chat_info -> author -> name), 'chatMessage' => htmlspecialchars ($chat_info -> message), 'answer' => htmlspecialchars ($dt[2])]; } } fclose ($f); unset ($f); if ($keyword !== '') { $log_data = array_filter ($log_data, fn ($row) => ( strpos (($row['chatName'] . "\n" . $row['chatMessage'] . "\n" . $row['answer']), $keyword) !== false)); } if ($date_start) { $log_data = array_filter ($log_data, fn ($row) => ( substr ($row['dateTime'], 0, 10) >= $date_start)); } if ($date_end) { $log_data = array_filter ($log_data, fn ($row) => ( substr ($row['dateTime'], 0, 10) <= $date_end)); } $pages_max = (int) ((count ($log_data) - 1) / $length) + 1; if (!($asc)) $log_data = array_reverse ($log_data); $log_data = array_slice ($log_data, ($page - 1) * $length, $length, true); echo json_encode ($log_data);