<commit_before><?php

/**
 * NS System script
 *
 * Copyright 2016-2019 <NAME> <<EMAIL>>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace core;

//Require PHP version >= 7.2.0
if (version_compare(PHP_VERSION, '7.2.0', '<')) {
    exit('NervSys needs PHP 7.2.0 or higher!');
}

//Define NervSys version
define('SYSVER', '7.4.0');

//Define system root path
define('SYSROOT', dirname(__DIR__));

//Get api path and cwd path
$api_path = strtr($_SERVER['SCRIPT_FILENAME'], '\\/', DIRECTORY_SEPARATOR);
$cwd_path = strtr(getcwd(), '\\/', DIRECTORY_SEPARATOR);

//Get entry script file path
$entry_script = false === strpos($api_path, $cwd_path)
    ? $cwd_path . DIRECTORY_SEPARATOR . $api_path
    : $api_path;

//Find true ROOT path
$sys_path   = explode(DIRECTORY_SEPARATOR, SYSROOT);
$entry_path = explode(DIRECTORY_SEPARATOR, $entry_script);
$root_path  = implode(DIRECTORY_SEPARATOR, array_intersect($sys_path, $entry_path));

//Define ROOT path
define('ROOT', $root_path);

//Define APP path (ROOT related)
define('APP_PATH', 'app');

//Define entry script file path (default: api.php)
define('ENTRY_SCRIPT', $entry_script);<commit_msg>fix getting entry path which cannot be fully replaced using strtr<commit_after><?php

/**
 * NS System script
 *
 * Copyright 2016-2019 <NAME> <<EMAIL>>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace core;

//Require PHP version >= 7.2.0
if (version_compare(PHP_VERSION, '7.2.0', '<')) {
    exit('NervSys needs PHP 7.2.0 or higher!');
}

//Define NervSys version
define('SYSVER', '7.4.0');

//Define system root path
define('SYSROOT', dirname(__DIR__));

//Get api path and cwd path
$api_path = strtr($_SERVER['SCRIPT_FILENAME'], '\\/', DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR);
$cwd_path = strtr(getcwd(), '\\/', DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR);

//Get entry script file path
$entry_script = false === strpos($api_path, $cwd_path)
    ? $cwd_path . DIRECTORY_SEPARATOR . $api_path
    : $api_path;

//Find true ROOT path
$sys_path   = explode(DIRECTORY_SEPARATOR, SYSROOT);
$entry_path = explode(DIRECTORY_SEPARATOR, $entry_script);
$root_path  = implode(DIRECTORY_SEPARATOR, array_intersect($sys_path, $entry_path));

//Define ROOT path
define('ROOT', $root_path);

//Define APP path (ROOT related)
define('APP_PATH', 'app');

//Define entry script file path (default: api.php)
define('ENTRY_SCRIPT', $entry_script);
{'fraction_non_alphanumeric': 0.13012895662368112, 'fraction_numerical': 0.01406799531066823, 'mean_word_length': 4.585924713584288, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, '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': '2672708', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1079, 'n_words': 356}