<commit_before><?php

/*
|--------------------------------------------------------------------------
| Register The Laravel Class Loader
|--------------------------------------------------------------------------
|
| In addition to using Composer, you may use the Laravel class loader to
| load your controllers and models. This is useful for keeping all of
| your classes in the "global" namespace without Composer updating.
|
*/

ClassLoader::addDirectories(array(
    // it is better to autoload in composer.json
));

/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
| is built on top of the wonderful Monolog library. By default we will
| build a rotating log file setup which creates a new file each day.
|
*/

$logFile = 'log-'.php_sapi_name().'.txt';

Log::useDailyFiles(storage_path().'/logs/'.$logFile);

/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/

App::error(function(Exception $exception, $code) {
    switch ($code) {
        case 404:
            Log::warning($exception);
        case 500:
            Log::critical($exception);
        default:
            Log::error($exception);
    }

    if (Config::get('app.debug') === false) {
        try {
            switch ($code) {
                case 400:
                    $details = array('exception' => $exception,
                        'code' => $code,
                        'name' => 'Bad Request',
                        'message' => 'The request cannot be fulfilled due to bad syntax.',
                        'extra' => $exception->getMessage());
                    return Response::view('error', $details, $code);
                case 401:
                    $details = array('exception' => $exception,
                        'code' => $code,
                        'name' => 'Unauthorized',
                        'message' => 'Authentication is required and has failed or has not yet been provided.',
                        'extra' => $exception->getMessage());
                    return Response::view('error', $details, $code);
                case 403:
                    $details = array('exception' => $exception,
                        'code' => $code,
                        'name' => 'Forbidden',
                        'message' => 'The request was a valid request, but the server is refusing to respond to it.',
                        'extra' => $exception->getMessage());<commit_msg>Added missing breaks on logging switch<commit_after><?php

/*
|--------------------------------------------------------------------------
| Register The Laravel Class Loader
|--------------------------------------------------------------------------
|
| In addition to using Composer, you may use the Laravel class loader to
| load your controllers and models. This is useful for keeping all of
| your classes in the "global" namespace without Composer updating.
|
*/

ClassLoader::addDirectories(array(
    // it is better to autoload in composer.json
));

/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
| is built on top of the wonderful Monolog library. By default we will
| build a rotating log file setup which creates a new file each day.
|
*/

$logFile = 'log-'.php_sapi_name().'.txt';

Log::useDailyFiles(storage_path().'/logs/'.$logFile);

/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/

App::error(function(Exception $exception, $code) {
    switch ($code) {
        case 404:
            Log::warning($exception);
            break;
        case 500:
            Log::critical($exception);
            break;
        default:
            Log::error($exception);
    }

    if (Config::get('app.debug') === false) {
        try {
            switch ($code) {
                case 400:
                    $details = array('exception' => $exception,
                        'code' => $code,
                        'name' => 'Bad Request',
                        'message' => 'The request cannot be fulfilled due to bad syntax.',
                        'extra' => $exception->getMessage());
                    return Response::view('error', $details, $code);
                case 401:
                    $details = array('exception' => $exception,
                        'code' => $code,
                        'name' => 'Unauthorized',
                        'message' => 'Authentication is required and has failed or has not yet been provided.',
                        'extra' => $exception->getMessage());
                    return Response::view('error', $details, $code);
                case 403:
                    $details = array('exception' => $exception,
                        'code' => $code,
                        'name' => 'Forbidden',
                        'message' => 'The request was a valid request, but the server is refusing to respond to it.',
                        'extra' => $exception->getMessage());
{'fraction_non_alphanumeric': 0.2376746426850811, 'fraction_numerical': 0.004817729243616509, 'mean_word_length': 1.3290949887808527, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '4185379', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1269, 'n_words': 502}