<commit_before><?php

use \Mascame\Artificer\Options\AdminOption;

Route::filter('artificer-auth', function () {
    $roles = AdminOption::get('auth.roles');
    $role_column = AdminOption::get('auth.role_column');

    if (Auth::guest()
        && Route::currentRouteName() != 'admin.model.showlogin'
        && Route::currentRouteName() != 'admin.login'
    )
    {
        if (Request::ajax())
        {
            return Response::make('Unauthorized', 401);
        }
        else
        {
            return Redirect::route('admin.model.showlogin');
        }
    } else if (Auth::check()
        && Route::currentRouteName() != 'admin.logout') {
        if (!in_array(Auth::user()->$role_column, $roles)) {
            return Redirect::route('admin.logout');
        }
    }
});

Route::filter('artificer-localization', function () {
	$langs = AdminOption::get('localization.user_locales');

	LaravelLocalization::setLocale(array_keys($langs)[0]);
	LaravelLocalization::setSupportedLocales($langs);
});<commit_msg>language setLocale if language is not avaliable<commit_after><?php

use \Mascame\Artificer\Options\AdminOption;

Route::filter('artificer-auth', function () {
    $roles = AdminOption::get('auth.roles');
    $role_column = AdminOption::get('auth.role_column');

    if (Auth::guest()
        && Route::currentRouteName() != 'admin.model.showlogin'
        && Route::currentRouteName() != 'admin.login'
    )
    {
        if (Request::ajax())
        {
            return Response::make('Unauthorized', 401);
        }
        else
        {
            return Redirect::route('admin.model.showlogin');
        }
    } else if (Auth::check()
        && Route::currentRouteName() != 'admin.logout') {
        if (!in_array(Auth::user()->$role_column, $roles)) {
            return Redirect::route('admin.logout');
        }
    }
});

Route::filter('artificer-localization', function () {
	$langs = AdminOption::get('localization.user_locales');

	if (!in_array(LaravelLocalization::getCurrentLocale(), $langs)) {
		LaravelLocalization::setLocale(array_keys($langs)[0]);
	}

	LaravelLocalization::setSupportedLocales($langs);
});
{'fraction_non_alphanumeric': 0.17627906976744187, 'fraction_numerical': 0.0037209302325581397, 'mean_word_length': 3.319277108433735, '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': '6563308', 'n_tokens_mistral': 679, 'n_tokens_neox': 663, 'n_words': 87}