<commit_before><?php

/**
 * Misc static functions that is used several places.in example parsing and id generation.
 *
 * @author <NAME>, UNINETT AS. <<EMAIL>>
 * @package simpleSAMLphp
 */
class SimpleSAML_Utilities {

	/**
	 * List of log levels.
	 *
	 * This list is used to restore the log levels after some log levels are disabled.
	 *
	 * @var array
	 */
	private static $logLevelStack = array();


	/**
	 * The current mask of disabled log levels.
	 *
	 * Note: This mask is not directly related to the PHP error reporting level.
	 *
	 * @var int
	 */
	public static $logMask = 0;


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfHost() instead.
	 */
	public static function getSelfHost() {
		return \SimpleSAML\Utils\HTTP::getSelfHost();
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfURLHost() instead.
	 */
	public static function selfURLhost() {
		return \SimpleSAML\Utils\HTTP::getSelfURLHost();
	}

	
	/**
	 * This function checks if we should set a secure cookie.
	 *
	 * @return TRUE if the cookie should be secure, FALSE otherwise.
	 */
	public static function isHTTPS() {

		$url = self::getBaseURL();

		$end = strpos($url,'://');
		$protocol = substr($url, 0, $end);

		if ($protocol === 'https') {
			return TRUE;
		} else {
			return FALSE;
		}

	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfURLNoQuery() instead.
	 */
	public static function selfURLNoQuery() {
		return \SimpleSAML\Utils\HTTP::getSelfURLNoQuery();
	
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfHostWithPath() instead.
	 */
	public static function getSelfHostWithPath() {
		return \SimpleSAML\Utils\HTTP::getSelfHostWithPath();
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getFirstPathElement() instead.
	 */
	public static function getFirstPathElement($trailingslash = true) {
		return \SimpleSAML\Utils\HTTP::getFirstPathElement($trailingslash);
	}


    /**
     * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfURL() instead.
     */
	public static function selfURL() {
		return \SimpleSAML\Utils\HTTP::getSelfURL();
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getBaseURL() instead.
	 */
	public static function getBaseURL() {
		return \SimpleSAML\Utils\HTTP::getBaseURL();
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::addURLParameters() instead.
	 */
	public static function addURLparameter($url, $parameters) {
		return \SimpleSAML\Utils\HTTP::addURLParameter($url, $parameters);
	}


	/**
	 * Check if a URL is valid and is in our list of allowed URLs.
	 *
	 * @param string $url The URL to check.
	 * @param array $trustedSites An optional white list of domains. If none specified, the 'trusted.url.domains'
	 * configuration directive will be used.
	 * @return string The normalized URL itself if it is allowed. An empty string if the $url parameter is empty as
	 * defined by the empty() function.
	 * @throws SimpleSAML_Error_Exception if the URL is malformed or is not allowed by configuration.
	 */
	public static function checkURLAllowed($url, array $trustedSites = NULL) {
		if (empty($url)) {<commit_msg>Bugfix.<commit_after><?php

/**
 * Misc static functions that is used several places.in example parsing and id generation.
 *
 * @author Andreas <NAME>, UNINETT AS. <<EMAIL>>
 * @package simpleSAMLphp
 */
class SimpleSAML_Utilities {

	/**
	 * List of log levels.
	 *
	 * This list is used to restore the log levels after some log levels are disabled.
	 *
	 * @var array
	 */
	private static $logLevelStack = array();


	/**
	 * The current mask of disabled log levels.
	 *
	 * Note: This mask is not directly related to the PHP error reporting level.
	 *
	 * @var int
	 */
	public static $logMask = 0;


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfHost() instead.
	 */
	public static function getSelfHost() {
		return \SimpleSAML\Utils\HTTP::getSelfHost();
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfURLHost() instead.
	 */
	public static function selfURLhost() {
		return \SimpleSAML\Utils\HTTP::getSelfURLHost();
	}

	
	/**
	 * This function checks if we should set a secure cookie.
	 *
	 * @return TRUE if the cookie should be secure, FALSE otherwise.
	 */
	public static function isHTTPS() {

		$url = self::getBaseURL();

		$end = strpos($url,'://');
		$protocol = substr($url, 0, $end);

		if ($protocol === 'https') {
			return TRUE;
		} else {
			return FALSE;
		}

	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfURLNoQuery() instead.
	 */
	public static function selfURLNoQuery() {
		return \SimpleSAML\Utils\HTTP::getSelfURLNoQuery();
	
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfHostWithPath() instead.
	 */
	public static function getSelfHostWithPath() {
		return \SimpleSAML\Utils\HTTP::getSelfHostWithPath();
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getFirstPathElement() instead.
	 */
	public static function getFirstPathElement($trailingslash = true) {
		return \SimpleSAML\Utils\HTTP::getFirstPathElement($trailingslash);
	}


    /**
     * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfURL() instead.
     */
	public static function selfURL() {
		return \SimpleSAML\Utils\HTTP::getSelfURL();
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getBaseURL() instead.
	 */
	public static function getBaseURL() {
		return \SimpleSAML\Utils\HTTP::getBaseURL();
	}


	/**
	 * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::addURLParameters() instead.
	 */
	public static function addURLparameter($url, $parameters) {
		return \SimpleSAML\Utils\HTTP::addURLParameters($url, $parameters);
	}


	/**
	 * Check if a URL is valid and is in our list of allowed URLs.
	 *
	 * @param string $url The URL to check.
	 * @param array $trustedSites An optional white list of domains. If none specified, the 'trusted.url.domains'
	 * configuration directive will be used.
	 * @return string The normalized URL itself if it is allowed. An empty string if the $url parameter is empty as
	 * defined by the empty() function.
	 * @throws SimpleSAML_Error_Exception if the URL is malformed or is not allowed by configuration.
	 */
	public static function checkURLAllowed($url, array $trustedSites = NULL) {
		if (empty($url)) {
{'fraction_non_alphanumeric': 0.11570128556983966, 'fraction_numerical': 0.00520005777841976, 'mean_word_length': 3.588469184890656, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '897778', 'n_tokens_mistral': 2273, 'n_tokens_neox': 2048, 'n_words': 713}