<commit_before><?php

error_reporting(E_ALL);

try {
    /**
     * Read the configuration
     */
    $config = include __DIR__ . "/../mvc/app/config/config.php";

    /**
     * Read auto-loader
     */
    include __DIR__ . "/../mvc/app/config/loader.php";

    /**
     * Read services
     */
    include __DIR__ . "/../mvc/app/config/services_api.php";

    /**
     * Handle the request
     */
    $application = new \Phalcon\Mvc\Application($di);

    echo $application->handle()->getContent();
} catch (\Exception $e) {
    $response = array();
    $response['errorMessage'] = $e->getMessage();
    if (method_exists($e, 'getTitle')) {
        $response['errorTitle'] = $e->getTitle();
    } else {
        $response['errorTitle'] = gettext("An API exception occured");
    }
    header('HTTP', true, 500);
    header("Content-Type: application/json;charset=utf-8");
    echo json_encode($response, JSON_UNESCAPED_SLASHES);
    error_log($e);
}<commit_msg>MVC/Exception handling, prevent UserException from being pushed to /tmp/PHP_errors.log<commit_after><?php

error_reporting(E_ALL);

try {
    /**
     * Read the configuration
     */
    $config = include __DIR__ . "/../mvc/app/config/config.php";

    /**
     * Read auto-loader
     */
    include __DIR__ . "/../mvc/app/config/loader.php";

    /**
     * Read services
     */
    include __DIR__ . "/../mvc/app/config/services_api.php";

    /**
     * Handle the request
     */
    $application = new \Phalcon\Mvc\Application($di);

    echo $application->handle()->getContent();
} catch (\Exception $e) {
    $response = array();
    $response['errorMessage'] = $e->getMessage();
    if (method_exists($e, 'getTitle')) {
        $response['errorTitle'] = $e->getTitle();
    } else {
        $response['errorTitle'] = gettext("An API exception occured");
        error_log($e);
    }
    header('HTTP', true, 500);
    header("Content-Type: application/json;charset=utf-8");
    echo json_encode($response, JSON_UNESCAPED_SLASHES);
}
{'fraction_non_alphanumeric': 0.17869586859133899, 'fraction_numerical': 0.003982080637132902, 'mean_word_length': 2.688073394495413, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '5491353', 'n_tokens_mistral': 659, 'n_tokens_neox': 641, 'n_words': 118}