<commit_before><?php
define('IN_TRANSLATE', 1);
include('inc/common.php');

$title = 'Log';
$top = '<a href="documents.php">Return to index</a>';
include('inc/start_html.php');
?>
<h1>Latest changes</h1>
<ul>
<?php
$req = db_query('
	SELECT l.*, u.username, d.name, d.path_original, x.lang_name
	FROM ' . DB_USERS . ' u, ' . DB_LOG . ' l
	LEFT JOIN ' . DB_DOCS . ' d ON l.log_doc = doc_id
	LEFT JOIN ' . DB_LANGS . ' x ON l.log_trans_lang = lang_code ' . "
	WHERE l.log_user = u.user_id " . '
	ORDER BY l.log_time DESC LIMIT 30');

$time = time();

while ($row = db_fetch($req)) {
	$user_id = $row['log_user'];
	$user_name = $row['username'];
	$log_time = intval($row['log_time']);
	$doc_id = $row['log_doc'];
	$doc_name = htmlspecialchars($row['name'] ? $row['name']
		: $row['path_original']);
	$doc_exists = true;<commit_msg>Simple (and ugly hacked) page limter for the log-browser.<commit_after><?php
define('IN_TRANSLATE', 1);
include('inc/common.php');

$title = 'Log';
$top = '<a href="documents.php">Return to index</a>';
include('inc/start_html.php');
?>
<h1>Latest changes</h1>
<ul>
<?php

$db_result = db_query('SELECT count(log_id) as count FROM ' . DB_LOG . ' WHERE 1');

$db_row = db_fetch($db_result);
$num_logs = $db_row['count'];
$num_per_page = 500;
$num_pages = ceil($num_logs/$num_per_page);
$page=1;

if(isset($_GET['page']))
	$page=$_GET['page'];

for($i=1; $i<$num_pages; $i++){
	if($page==$i){
		echo " $i ";
	}else{
		echo "<a href=?page=$i> $i </a>";
	}
}

$req = db_query('
	SELECT l.*, u.username, d.name, d.path_original, x.lang_name
	FROM ' . DB_USERS . ' u, ' . DB_LOG . ' l
	LEFT JOIN ' . DB_DOCS . ' d ON l.log_doc = doc_id
	LEFT JOIN ' . DB_LANGS . ' x ON l.log_trans_lang = lang_code ' . "
	WHERE l.log_user = u.user_id " . '
	ORDER BY l.log_time DESC LIMIT ' . ($page-1)*$num_per_page.', '.$num_per_page);

$time = time();



while ($row = db_fetch($req)) {
	$user_id = $row['log_user'];
	$user_name = $row['username'];
	$log_time = intval($row['log_time']);
	$doc_id = $row['log_doc'];
	$doc_name = htmlspecialchars($row['name'] ? $row['name']
		: $row['path_original']);
	$doc_exists = true;
{'fraction_non_alphanumeric': 0.21888210427430718, 'fraction_numerical': 0.007045561296383279, 'mean_word_length': 4.461538461538462, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 17, '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': '2530857', 'n_tokens_mistral': 912, 'n_tokens_neox': 890, 'n_words': 182}