<commit_before><?php

if (!isset($_)) { //also provide standalone error page
	require_once __DIR__ . '/../../../lib/base.php';

	$l = OC_L10N::get('files_encryption');

	if (isset($_GET['errorCode'])) {
		$errorCode = $_GET['errorCode'];
		switch ($errorCode) {
			case \OCA\Encryption\Crypt::ENCRYPTION_NOT_INITIALIZED_ERROR:
				$errorMsg = $l->t('Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app.');
				break;
			case \OCA\Encryption\Crypt::ENCRYPTION_PRIVATE_KEY_NOT_VALID_ERROR:
				$errorMsg = $l->t('Your private key is not valid! Likely your password was changed outside the ownCloud system (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files.');
				break;
			case \OCA\Encryption\Crypt::ENCRYPTION_NO_SHARE_KEY_FOUND:
				$errorMsg = $l->t('Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.');
				break;
			default:
				$errorMsg = $l->t("Unknwon error please check your system settings or contact your administrator");
				break;
		}
	} else {
		$errorCode = \OCA\Encryption\Crypt::ENCRYPTION_UNKNOWN_ERROR;
		$errorMsg = $l->t("Unknwon error please check your system settings or contact your administrator");
	}

	if (isset($_GET['p']) && $_GET['p'] === '1') {
		header('HTTP/1.0 404 ' . $errorMsg);
	}

// check if ajax request
	if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
		\OCP\JSON::error(array('data' => array('message' => $errorMsg)));
	} else {
		header('HTTP/1.0 404 ' . $errorMsg);
		$tmpl = new OC_Template('files_encryption', 'invalid_private_key', 'guest');
		$tmpl->assign('message', $errorMsg);
		$tmpl->assign('errorCode', $errorCode);
		$tmpl->printPage();
	}

	exit;
}
<commit_msg>fix typo in error message and change error code to 403<commit_after><?php

if (!isset($_)) { //also provide standalone error page
	require_once __DIR__ . '/../../../lib/base.php';

	$l = OC_L10N::get('files_encryption');

	if (isset($_GET['errorCode'])) {
		$errorCode = $_GET['errorCode'];
		switch ($errorCode) {
			case \OCA\Encryption\Crypt::ENCRYPTION_NOT_INITIALIZED_ERROR:
				$errorMsg = $l->t('Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app.');
				break;
			case \OCA\Encryption\Crypt::ENCRYPTION_PRIVATE_KEY_NOT_VALID_ERROR:
				$errorMsg = $l->t('Your private key is not valid! Likely your password was changed outside the ownCloud system (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files.');
				break;
			case \OCA\Encryption\Crypt::ENCRYPTION_NO_SHARE_KEY_FOUND:
				$errorMsg = $l->t('Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.');
				break;
			default:
				$errorMsg = $l->t("Unknown error please check your system settings or contact your administrator");
				break;
		}
	} else {
		$errorCode = \OCA\Encryption\Crypt::ENCRYPTION_UNKNOWN_ERROR;
		$errorMsg = $l->t("Unknwon error please check your system settings or contact your administrator");
	}

	if (isset($_GET['p']) && $_GET['p'] === '1') {
		header('HTTP/1.0 403 ' . $errorMsg);
	}

// check if ajax request
	if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
		\OCP\JSON::error(array('data' => array('message' => $errorMsg)));
	} else {
		header('HTTP/1.0 404 ' . $errorMsg);
		$tmpl = new OC_Template('files_encryption', 'invalid_private_key', 'guest');
		$tmpl->assign('message', $errorMsg);
		$tmpl->assign('errorCode', $errorCode);
		$tmpl->printPage();
	}

	exit;
}

{'fraction_non_alphanumeric': 0.14722995193523905, 'fraction_numerical': 0.007336200354161397, 'mean_word_length': 4.514644351464435, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3382708', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1257, 'n_words': 368}