function getUrlLanguage($defaultLanguage = 'ru', $allowedLanguages = ['ru', 'en']) {
$urlLanguage = $defaultLanguage;
$urlPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if ($urlPath) {
$urlPathExploded = explode('/', $urlPath);
if (in_array($urlPathExploded['1'], $allowedLanguages)) {
$urlLanguage = $urlPathExploded['1'];
}
}
return $urlLanguage;
}