<commit_before><?php

require_once('memcache.incl.php');
require_once('incl.php');

define('API_VERSION', 10);
define('THROTTLE_PERIOD', 3600); // seconds
define('THROTTLE_MAXHITS', 200);
define('BANLIST_CACHEKEY', 'banlist_cidrs3');
define('BANLIST_FILENAME', __DIR__ . '/banlist.txt');

if ((PHP_SAPI != 'cli') && (($inMaintenance = APIMaintenance()) !== false)) {
    header('HTTP/1.1 503 Service Unavailable');
    header('Content-type: application/json');
    header('Cache-Control: no-cache');

    echo json_encode(['maintenance' => $inMaintenance]);
    exit;
}

function json_return($json)
{
    if ($json === false) {
        header('HTTP/1.1 400 Bad Request');
        exit;
    }

    ini_set('zlib.output_compression', 1);

    if (!is_string($json)) {
        $json = json_encode($json, JSON_NUMERIC_CHECK);
    }

    header('Content-type: application/json');
    echo $json;
    exit;
}
<commit_msg>refresh banlist cache<commit_after><?php

require_once('memcache.incl.php');
require_once('incl.php');

define('API_VERSION', 10);
define('THROTTLE_PERIOD', 3600); // seconds
define('THROTTLE_MAXHITS', 200);
define('BANLIST_CACHEKEY', 'banlist_cidrs4');
define('BANLIST_FILENAME', __DIR__ . '/banlist.txt');

if ((PHP_SAPI != 'cli') && (($inMaintenance = APIMaintenance()) !== false)) {
    header('HTTP/1.1 503 Service Unavailable');
    header('Content-type: application/json');
    header('Cache-Control: no-cache');

    echo json_encode(['maintenance' => $inMaintenance]);
    exit;
}

function json_return($json)
{
    if ($json === false) {
        header('HTTP/1.1 400 Bad Request');
        exit;
    }

    ini_set('zlib.output_compression', 1);

    if (!is_string($json)) {
        $json = json_encode($json, JSON_NUMERIC_CHECK);
    }

    header('Content-type: application/json');
    echo $json;
    exit;
}

{'fraction_non_alphanumeric': 0.18280739934711643, 'fraction_numerical': 0.022850924918389554, 'mean_word_length': 4.209631728045326, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3051370', 'n_tokens_mistral': 668, 'n_tokens_neox': 633, 'n_words': 112}