<commit_before><?php

use \Silex\Application;

$app->before(function() use ($app) {
    if (isset($_COOKIE['jz_auth_succeed'])) {
        return;
    }

    if ($_SERVER['REQUEST_URI'] === '/screensaver/') {
        return;
    }

    if (
        !isset($_SERVER['PHP_AUTH_USER'])
        || !isset($app['users'][$_SERVER['PHP_AUTH_USER']])
        || $app['users'][$_SERVER['PHP_AUTH_USER']] !== $_SERVER['PHP_AUTH_PW']
    ) {
        header('WWW-Authenticate: Basic realm="Login required"');
        return $app->json(['Message' => 'Not authorized'], 401);
    }

    setcookie('jz.auth.succeed', true, time() + 31556926);
    $_COOKIE['jz.auth.succeed'] = true;
}, Application::EARLY_EVENT);<commit_msg>Added screensaver<commit_after><?php

use \Silex\Application;

$app->before(function() use ($app) {
    if (isset($_COOKIE['jz_auth_succeed'])) {
        return;
    }

    if (in_array($_SERVER['REQUEST_URI'], ['/screensaver/', '/refresh/'])) {
        return;
    }

    if (
        !isset($_SERVER['PHP_AUTH_USER'])
        || !isset($app['users'][$_SERVER['PHP_AUTH_USER']])
        || $app['users'][$_SERVER['PHP_AUTH_USER']] !== $_SERVER['PHP_AUTH_PW']
    ) {
        header('WWW-Authenticate: Basic realm="Login required"');
        return $app->json(['Message' => 'Not authorized'], 401);
    }

    setcookie('jz.auth.succeed', true, time() + 31556926);
    $_COOKIE['jz.auth.succeed'] = true;
}, Application::EARLY_EVENT);
{'fraction_non_alphanumeric': 0.21289875173370318, 'fraction_numerical': 0.015256588072122053, 'mean_word_length': 3.509375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1538127', 'n_tokens_mistral': 528, 'n_tokens_neox': 501, 'n_words': 69}