<commit_before><?php
/**
 * This file is part of the Passwords App
 * created by <NAME>
 * and licensed under the AGPL.
 *
 * @var $l \OCP\IL10N
 * @var $_ array
 */

$uid = \OC::$server->getUserSession()->getUser()->getUID();
if(!\OC_User::isAdminUser($uid)) return;

$config  = \OC::$server->getConfig();
$request = \OC::$server->getRequest();


$headers = $config->getSystemValue('forwarded_for_headers', ['HTTP_X_FORWARDED_FOR']);
$isProxy = isset($_SERVER['HTTP_X_FORWARDED_FOR']) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) || isset($_SERVER['HTTP_X_FORWARDED_PORT']);

$expected = [
        'remote_address' => $_SERVER['REMOTE_ADDR'],
        'overwriteprotocol' => 'not set',
        'overwritecondaddr' => 'not set',
        'trusted_proxies' => '[]',
        'forwarded_proto' => 'not set',
        'forwarded_for' => 'not set',
        'proxy' => 'Yes if Proxy'
];

foreach($headers as $header) {
    if(isset($_SERVER[$header])) {
        $expected['remote_address'] = $_SERVER[$header];
        $isProxy = true;
    }
}

if($isProxy) {
    $expected['proxy'] = '';
    $expected['forwarded_proto'] = 'https';
    $expected['forwarded_for'] = $expected['remote_address'];
    $expected['overwriteprotocol'] = 'https';

    if($expected['remote_address'] !== $_SERVER['REMOTE_ADDR']) {
        $expected['overwritecondaddr'] = '^'.str_replace('.', '\.', $_SERVER['REMOTE_ADDR']).'$';
        $expected['trusted_proxies'] = "[\"{$_SERVER['REMOTE_ADDR']}\"]";
    } else {
        $expected['overwritecondaddr'] = '^your\.proxy\.ip$';
        $expected['trusted_proxies'] = '["your.proxy.ip"]';
    }
}

?>

<div class="message report"><commit_msg>Changed wording in https debugger<commit_after><?php
/**
 * This file is part of the Passwords App
 * created by <NAME>
 * and licensed under the AGPL.
 *
 * @var $l \OCP\IL10N
 * @var $_ array
 */

$uid = \OC::$server->getUserSession()->getUser()->getUID();
if(!\OC_User::isAdminUser($uid)) return;

$config  = \OC::$server->getConfig();
$request = \OC::$server->getRequest();


$headers = $config->getSystemValue('forwarded_for_headers', ['HTTP_X_FORWARDED_FOR']);
$isProxy = isset($_SERVER['HTTP_X_FORWARDED_FOR']) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) || isset($_SERVER['HTTP_X_FORWARDED_PORT']);

$expected = [
        'remote_address' => $_SERVER['REMOTE_ADDR'],
        'overwriteprotocol' => 'not set',
        'overwritecondaddr' => 'not set',
        'trusted_proxies' => '[]',
        'forwarded_proto' => 'not set',
        'forwarded_for' => 'not set',
        'proxy' => 'Yes if Proxy'
];

foreach($headers as $header) {
    if(isset($_SERVER[$header])) {
        $expected['remote_address'] = $_SERVER[$header];
        $isProxy = true;
    }
}

if($isProxy) {
    $expected['proxy'] = '';
    $expected['forwarded_proto'] = 'https';
    $expected['forwarded_for'] = $expected['remote_address'];
    $expected['overwriteprotocol'] = 'https';

    if($expected['remote_address'] !== $_SERVER['REMOTE_ADDR']) {
        $expected['overwritecondaddr'] = '^'.str_replace('.', '\.', $_SERVER['REMOTE_ADDR']).'$';
        $expected['trusted_proxies'] = "[\"{$_SERVER['REMOTE_ADDR']}\"]";
    } else {
        $expected['overwritecondaddr'] = '^the\.proxy\.ip$';
        $expected['trusted_proxies'] = '["the.proxy.ip"]';
    }
}

?>

<div class="message report">
{'fraction_non_alphanumeric': 0.2158273381294964, 'fraction_numerical': 0.001199040767386091, 'mean_word_length': 4.110260336906585, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 35, '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': '6330381', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1146, 'n_words': 179}