<commit_before><?php
require_once "../../../include/db.php";
require_once "../../../include/general.php";

$ref = filter_input(INPUT_GET, 'ref', FILTER_VALIDATE_INT);
$ocr_state = filter_input(INPUT_GET, 'ocr_state', FILTER_VALIDATE_INT);

sql_query("UPDATE resource SET ocr_state =  '$ocr_state' WHERE ref = '$ref'");

$new_state = sql_value("SELECT ocr_state value FROM resource WHERE ref = '$ref'", '');

echo ($new_state);
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

<commit_msg>check for non-false values returned from filter_input<commit_after><?php
require_once "../../../include/db.php";
require_once "../../../include/general.php";

$ref = filter_input(INPUT_GET, 'ref', FILTER_VALIDATE_INT);
$ocr_state = filter_input(INPUT_GET, 'ocr_state', FILTER_VALIDATE_INT);

if ($ref && $ocr_state) {
    sql_query("UPDATE resource SET ocr_state =  '$ocr_state' WHERE ref = '$ref'");
}
{'fraction_non_alphanumeric': 0.16245136186770429, 'fraction_numerical': 0.0, 'mean_word_length': 4.88, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7025977', 'n_tokens_mistral': 332, 'n_tokens_neox': 333, 'n_words': 88}