<commit_before><?
/**
 * functions used on every page, which is called by http
 *
 * @author <NAME> <<EMAIL>>
 * @package Basisentscheid
 * @see inc/common_http.php
 */


/**
 * http redirect
 *
 * To make fragments work with all browsers, the fragment has to be provided here *and* in the link or form leading to the redirect.
 *
 * @param string  $target (optional) relative or absolute URI with fragment or only fragment
 */
function redirect($target="") {

	if ($target) {
		if (!lefteq($target, "/") and !lefteq($target, "http")) {
			// make relative paths absolute
			$dirname = dirname($_SERVER['PHP_SELF']);
			if ($dirname=="/") {
				$target = "/".$target;
			} elseif (lefteq($target, "#")) {
				$target = $dirname."/".URI::same(true).$target;
			} else {
				$target = $dirname."/".$target;
			}
		}
	} else {
		// reload the page to get rid of POST data
		$target = $_SERVER['REQUEST_URI'];
	}

	if (DEBUG) {
		// save page infos to show them in the debug output on the next page
		if (!isset($_SESSION['redirects'])) $_SESSION['redirects'] = array();
		$_SESSION['redirects'][] = array(
			'target'      => $target,
			'BN'          => BN,
			'REQUEST_URI' => $_SERVER['REQUEST_URI'],
			'GET'         => $_GET,
			'POST'        => $_POST
		);
	}

	// save not yet displayed output to display it on the next page
	if (isset($_SESSION['output'])) {
		$_SESSION['output'] .= ob_get_clean();
	} else {
		$_SESSION['output'] = ob_get_clean();
	}<commit_msg>fix: redirect path<commit_after><?
/**
 * functions used on every page, which is called by http
 *
 * @author <NAME> <<EMAIL>>
 * @package Basisentscheid
 * @see inc/common_http.php
 */


/**
 * http redirect
 *
 * To make fragments work with all browsers, the fragment has to be provided here *and* in the link or form leading to the redirect.
 *
 * @param string  $target (optional) relative or absolute URI with fragment or only fragment
 */
function redirect($target="") {

	if ($target) {
		if (!lefteq($target, "/") and !lefteq($target, "http")) {
			// make relative paths absolute
			$dirname = dirname($_SERVER['PHP_SELF']);
			if ($dirname!="/") $dirname .= "/";
			if (lefteq($target, "#")) {
				$target = $dirname.URI::same(true).$target;
			} else {
				$target = $dirname.$target;
			}
		}
	} else {
		// reload the page to get rid of POST data
		$target = $_SERVER['REQUEST_URI'];
	}

	if (DEBUG) {
		// save page infos to show them in the debug output on the next page
		if (!isset($_SESSION['redirects'])) $_SESSION['redirects'] = array();
		$_SESSION['redirects'][] = array(
			'target'      => $target,
			'BN'          => BN,
			'REQUEST_URI' => $_SERVER['REQUEST_URI'],
			'GET'         => $_GET,
			'POST'        => $_POST
		);
	}

	// save not yet displayed output to display it on the next page
	if (isset($_SESSION['output'])) {
		$_SESSION['output'] .= ob_get_clean();
	} else {
		$_SESSION['output'] = ob_get_clean();
	}
{'fraction_non_alphanumeric': 0.1734658896126157, 'fraction_numerical': 0.0, 'mean_word_length': 3.2474526928675402, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '6849851', 'n_tokens_mistral': 1024, 'n_tokens_neox': 927, 'n_words': 293}