<commit_before><?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright    Copyright 2013, Block 8 Limited.
* @license      https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link         http://www.phptesting.org/
*/

use PHPCensor\Logging\LoggerConfig;

if (!defined('ROOT_DIR')) {
    define('ROOT_DIR', __DIR__ . DIRECTORY_SEPARATOR);
}

if (!defined('SRC_DIR')) {
    define('SRC_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR);
}

if (!defined('PUBLIC_DIR')) {
    define('PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
}

if (!defined('APP_DIR')) {
    define('APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
}

if (!defined('BIN_DIR')) {
    define('BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
}

if (!defined('RUNTIME_DIR')) {
    define('RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
}

if (!defined('IS_WIN')) {
    define('IS_WIN', ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false));
}

require_once(ROOT_DIR . 'vendor/autoload.php');

if (defined('IS_CONSOLE') && IS_CONSOLE) {
    $loggerConfig = LoggerConfig::newFromFile(APP_DIR . "loggerconfig.php");
}

// Load configuration if present:
$conf = [];
$conf['b8']['app']['namespace']          = 'PHPCensor';
$conf['b8']['app']['default_controller'] = 'Home';
$conf['b8']['view']['path']              = SRC_DIR . 'View' . DIRECTORY_SEPARATOR;

$config = new b8\Config($conf);

$configFile = APP_DIR . 'config.yml';
if (file_exists($configFile)) {
    $config->loadYaml($configFile);
}

if (!defined('APP_URL') && !empty($config)) {
    define('APP_URL', $config->get('php-censor.url', '') . '/');
}

if (!defined('IS_CONSOLE')) {
    define('IS_CONSOLE', false);
}

\PHPCensor\Helper\Lang::init($config, 'ru');<commit_msg>Fixed init language. Issue #9<commit_after><?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright    Copyright 2013, Block 8 Limited.
* @license      https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link         http://www.phptesting.org/
*/

use PHPCensor\Logging\LoggerConfig;

if (!defined('ROOT_DIR')) {
    define('ROOT_DIR', __DIR__ . DIRECTORY_SEPARATOR);
}

if (!defined('SRC_DIR')) {
    define('SRC_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR);
}

if (!defined('PUBLIC_DIR')) {
    define('PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
}

if (!defined('APP_DIR')) {
    define('APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
}

if (!defined('BIN_DIR')) {
    define('BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
}

if (!defined('RUNTIME_DIR')) {
    define('RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
}

if (!defined('IS_WIN')) {
    define('IS_WIN', ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false));
}

require_once(ROOT_DIR . 'vendor/autoload.php');

if (defined('IS_CONSOLE') && IS_CONSOLE) {
    $loggerConfig = LoggerConfig::newFromFile(APP_DIR . "loggerconfig.php");
}

// Load configuration if present:
$conf = [];
$conf['b8']['app']['namespace']          = 'PHPCensor';
$conf['b8']['app']['default_controller'] = 'Home';
$conf['b8']['view']['path']              = SRC_DIR . 'View' . DIRECTORY_SEPARATOR;

$config = new b8\Config($conf);

$configFile = APP_DIR . 'config.yml';
if (file_exists($configFile)) {
    $config->loadYaml($configFile);
}

if (!defined('APP_URL') && !empty($config)) {
    define('APP_URL', $config->get('php-censor.url', '') . '/');
}

if (!defined('IS_CONSOLE')) {
    define('IS_CONSOLE', false);
}

\PHPCensor\Helper\Lang::init($config);
{'fraction_non_alphanumeric': 0.20632698768197089, 'fraction_numerical': 0.006998880179171333, 'mean_word_length': 4.522411128284389, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '5765352', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1305, 'n_words': 212}