<commit_before><!DOCTYPE html>
<html lang="en">
<?php
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/highscores.php');
require_once (__DIR__ . '/../internals/alephnoteStatistics.php');
require_once (__DIR__ . '/../internals/blog.php');
require_once (__DIR__ . '/../internals/euler.php');
require_once (__DIR__ . '/../internals/adventofcode.php');
require_once (__DIR__ . '/../internals/highscores.php');
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
require_once (__DIR__ . '/../internals/programs.php');
require_once (__DIR__ . '/../internals/books.php');
require_once (__DIR__ . '/../internals/updateslog.php');

$connected = Database::tryconnect();

$consistency_blog    = Blog::checkConsistency();
$consistency_prog    = Programs::checkConsistency();
$consistency_euler   = Euler::checkConsistency();
$consistency_books   = Books::checkConsistency();
$consistency_egg     = MikescherGitGraph::checkConsistency();
$consistency_progimg = Programs::checkThumbnails();
$consistency_bookimg = Books::checkThumbnails();
$consistency_aoc     = AdventOfCode::checkConsistency();

?>
<?php

function dumpConsistency($c) {
	if ($c['result']==='ok') echo "<span class='consistency_result_ok'>OK</span>";
	else if ($c['result']==='warn') echo "<span class='consistency_result_warn'>".$c['message']."</span>";
	else echo "<span class='consistency_result_err'>".$c['message']."</span>";
}

?>
<head>
	<meta charset="utf-8">
	<title>Mikescher.com - Admin</title>
	<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
	<link rel="canonical" href="https://www.mikescher.com/about"/>
	<?php printHeaderCSS(); ?>
	<?php includeAdditionalScript("https://code.jquery.com/jquery-latest.min.js", '', true) ?>
	<?php includeAdditionalScript("/data/javascript/admin.js", 'defer', true) ?>
</head>
<body>
<div id="mastercontainer">

	<?php $HEADER_ACTIVE = 'admin'; include (__DIR__ . '/../fragments/header.php'); ?>

	<div id="content" class="content-responsive">

		<div class="admincontent">

			<div class="contentheader"><h1>Admin</h1><hr/></div>

			<?php if (!$connected): ?>
                <div class="boxedcontent alertbox">
                    <div class="bc_data">Could not connect to database</div>
                </div>
			<?php endif; ?>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">Version</div>

                <div class="bc_data keyvaluelist kvl_100">
                    <div><span>Branch:</span> <span><?php echo exec('git rev-parse --abbrev-ref HEAD'); ?></span></div>
                    <div><span>Commit:</span> <span><?php echo exec('git rev-parse HEAD'); ?></span></div>
                    <div><span>Date:</span>   <span><?php echo exec('git log -1 --format=%cd'); ?></span></div>
                    <div><span>Message:</span><span><?php echo nl2br(trim(exec('git log -1'))); ?></span></div>
                </div>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">Self test</div>

                <div class="bc_data">
                    <div class="keyvaluelist kvl_200">
                        <div><span>Program thumbnails:</span> <?php dumpConsistency($consistency_progimg); ?></div>
                        <div><span>ExtendedGitGraph:</span>   <?php dumpConsistency($consistency_egg);     ?></div>
                        <div><span>Book thumbnails:</span>    <?php dumpConsistency($consistency_bookimg); ?></div>
                        <div><span>Blog data:</span>          <?php dumpConsistency($consistency_blog);    ?></div>
                        <div><span>Euler data:</span>         <?php dumpConsistency($consistency_euler);   ?></div>
                        <div><span>AdventOfCode data:</span>  <?php dumpConsistency($consistency_aoc);     ?></div>
                        <div><span>Programs data:</span>      <?php dumpConsistency($consistency_prog);    ?></div>
                        <div><span>Books data:</span>         <?php dumpConsistency($consistency_books);   ?></div>
                    </div>
                    <br/>
                    <a class="button" href="/api/site::createProgramThumbnails">Update Program Thumbnails</a>
                    <a class="button" href="/api/site::createBookThumbnails">Update Book Thumbnails</a>

                </div>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">Self IP Addr</div>

                <?php
                $ippath = __DIR__ . '/../dynamic/self_ip_address.auto.cfg';
                $self_ip = file_exists($ippath) ? file_get_contents($ippath) : 'N/A';
                $real_ip = get_client_ip();
                $me = $real_ip == $self_ip
                ?>

                <div class="bc_data keyvaluelist kvl_200">
                    <div><span>Registered IP:</span> <span><?php echo $self_ip; ?></span></div>
                    <div><span>Current IP:</span> <span><?php echo $real_ip; ?></span></div>
                </div>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">ExtendedGitGraph</div>

                <div class="bc_data">

                    <textarea class="egg_ajaxOutput" id="egg_ajaxOutput" readonly="readonly"></textarea>
                    <a class="button" href="javascript:startAjaxRefresh('<?php echo $CONFIG['ajax_secret'] ?>')">Update</a>
                    <a class="button" href="javascript:startAjaxRedraw('<?php echo $CONFIG['ajax_secret'] ?>')">Redraw</a>

                </div>

            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">AlephNote</div>

                <?php if ($connected): ?>
                    <div class="bc_data">
                        <div class="keyvaluelist kvl_200">
                            <div><span>Total users:</span> <span><?php echo AlephNoteStatistics::getTotalUserCount(); ?></span></div>
                            <div><span>Users on latest version:</span> <span><?php echo AlephNoteStatistics::getUserCountFromLastVersion(); ?></span></div>
                            <div><span>Active users:</span> <span><?php echo AlephNoteStatistics::getActiveUserCount(32); ?></span></div>
                        </div>
                        <br/>
                        <div id="an_ajax_target"></div>
                        <a class="button" href="javascript:startAjaxReplace('#an_ajax_target', '/api/alephnote::show?secret=<?php echo $CONFIG['ajax_secret'] ?>')">Show</a>
                    </div>
                <?php else: ?>
                    <div class="bc_data keyvaluelist">Database not connected.</div>
                <?php endif; ?>

            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">Statics</div>

                <div class="bc_data keyvaluelist kvl_200">
                    <div><span>Blog entries:</span> <span><?php    echo count(Blog::listAll()); ?></span></div>
                    <div><span>Book entries:</span> <span><?php    echo count(Books::listAll()); ?></span></div>
                    <div><span>Euler entries:</span> <span><?php   echo count(Euler::listAll()); ?></span></div>
                    <div><span>Program entries:</span> <span><?php echo count(Programs::listAll()); ?></span></div>
                    <div><span>Update entries:</span> <span><?php  echo count(Programs::listUpdateData()); ?></span></div>
                </div>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">UpdatesLog</div>

				<?php if ($connected): ?>
                    <div class="bc_data keyvaluelist kvl_300">
                        <?php foreach (UpdatesLog::listProgramsInformation() as $info): ?>
                            <div><span><?php echo '[' . $info['name'] . '] Count:' ?></span> <span><a href="javascript:startAjaxReplace('#ul_ajax_target', '/admin/updates::show?secret=<?php echo $CONFIG['ajax_secret'] ?>&ulname=<?php echo $info['name'] ?>')"><?php echo $info['count_total']; ?></a></span></div>
                            <div><span><?php echo '[' . $info['name'] . '] Last query:' ?></span> <span><?php echo $info['last_query']; ?></span></div>
                            <div><span><?php echo '[' . $info['name'] . '] Count (1 week):' ?></span> <span><?php echo $info['count_week']; ?></span></div>
                            <hr />
                        <?php endforeach; ?>
                        <br/>
                        <div id="ul_ajax_target"></div>
                    </div>
                <?php else: ?>
                    <div class="bc_data keyvaluelist">Database not connected.</div>
                <?php endif; ?>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent"><commit_msg>fix api link [updates::show]<commit_after><!DOCTYPE html>
<html lang="en">
<?php
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/highscores.php');
require_once (__DIR__ . '/../internals/alephnoteStatistics.php');
require_once (__DIR__ . '/../internals/blog.php');
require_once (__DIR__ . '/../internals/euler.php');
require_once (__DIR__ . '/../internals/adventofcode.php');
require_once (__DIR__ . '/../internals/highscores.php');
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
require_once (__DIR__ . '/../internals/programs.php');
require_once (__DIR__ . '/../internals/books.php');
require_once (__DIR__ . '/../internals/updateslog.php');

$connected = Database::tryconnect();

$consistency_blog    = Blog::checkConsistency();
$consistency_prog    = Programs::checkConsistency();
$consistency_euler   = Euler::checkConsistency();
$consistency_books   = Books::checkConsistency();
$consistency_egg     = MikescherGitGraph::checkConsistency();
$consistency_progimg = Programs::checkThumbnails();
$consistency_bookimg = Books::checkThumbnails();
$consistency_aoc     = AdventOfCode::checkConsistency();

?>
<?php

function dumpConsistency($c) {
	if ($c['result']==='ok') echo "<span class='consistency_result_ok'>OK</span>";
	else if ($c['result']==='warn') echo "<span class='consistency_result_warn'>".$c['message']."</span>";
	else echo "<span class='consistency_result_err'>".$c['message']."</span>";
}

?>
<head>
	<meta charset="utf-8">
	<title>Mikescher.com - Admin</title>
	<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
	<link rel="canonical" href="https://www.mikescher.com/about"/>
	<?php printHeaderCSS(); ?>
	<?php includeAdditionalScript("https://code.jquery.com/jquery-latest.min.js", '', true) ?>
	<?php includeAdditionalScript("/data/javascript/admin.js", 'defer', true) ?>
</head>
<body>
<div id="mastercontainer">

	<?php $HEADER_ACTIVE = 'admin'; include (__DIR__ . '/../fragments/header.php'); ?>

	<div id="content" class="content-responsive">

		<div class="admincontent">

			<div class="contentheader"><h1>Admin</h1><hr/></div>

			<?php if (!$connected): ?>
                <div class="boxedcontent alertbox">
                    <div class="bc_data">Could not connect to database</div>
                </div>
			<?php endif; ?>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">Version</div>

                <div class="bc_data keyvaluelist kvl_100">
                    <div><span>Branch:</span> <span><?php echo exec('git rev-parse --abbrev-ref HEAD'); ?></span></div>
                    <div><span>Commit:</span> <span><?php echo exec('git rev-parse HEAD'); ?></span></div>
                    <div><span>Date:</span>   <span><?php echo exec('git log -1 --format=%cd'); ?></span></div>
                    <div><span>Message:</span><span><?php echo nl2br(trim(exec('git log -1'))); ?></span></div>
                </div>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">Self test</div>

                <div class="bc_data">
                    <div class="keyvaluelist kvl_200">
                        <div><span>Program thumbnails:</span> <?php dumpConsistency($consistency_progimg); ?></div>
                        <div><span>ExtendedGitGraph:</span>   <?php dumpConsistency($consistency_egg);     ?></div>
                        <div><span>Book thumbnails:</span>    <?php dumpConsistency($consistency_bookimg); ?></div>
                        <div><span>Blog data:</span>          <?php dumpConsistency($consistency_blog);    ?></div>
                        <div><span>Euler data:</span>         <?php dumpConsistency($consistency_euler);   ?></div>
                        <div><span>AdventOfCode data:</span>  <?php dumpConsistency($consistency_aoc);     ?></div>
                        <div><span>Programs data:</span>      <?php dumpConsistency($consistency_prog);    ?></div>
                        <div><span>Books data:</span>         <?php dumpConsistency($consistency_books);   ?></div>
                    </div>
                    <br/>
                    <a class="button" href="/api/site::createProgramThumbnails">Update Program Thumbnails</a>
                    <a class="button" href="/api/site::createBookThumbnails">Update Book Thumbnails</a>

                </div>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">Self IP Addr</div>

                <?php
                $ippath = __DIR__ . '/../dynamic/self_ip_address.auto.cfg';
                $self_ip = file_exists($ippath) ? file_get_contents($ippath) : 'N/A';
                $real_ip = get_client_ip();
                $me = $real_ip == $self_ip
                ?>

                <div class="bc_data keyvaluelist kvl_200">
                    <div><span>Registered IP:</span> <span><?php echo $self_ip; ?></span></div>
                    <div><span>Current IP:</span> <span><?php echo $real_ip; ?></span></div>
                </div>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">ExtendedGitGraph</div>

                <div class="bc_data">

                    <textarea class="egg_ajaxOutput" id="egg_ajaxOutput" readonly="readonly"></textarea>
                    <a class="button" href="javascript:startAjaxRefresh('<?php echo $CONFIG['ajax_secret'] ?>')">Update</a>
                    <a class="button" href="javascript:startAjaxRedraw('<?php echo $CONFIG['ajax_secret'] ?>')">Redraw</a>

                </div>

            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">AlephNote</div>

                <?php if ($connected): ?>
                    <div class="bc_data">
                        <div class="keyvaluelist kvl_200">
                            <div><span>Total users:</span> <span><?php echo AlephNoteStatistics::getTotalUserCount(); ?></span></div>
                            <div><span>Users on latest version:</span> <span><?php echo AlephNoteStatistics::getUserCountFromLastVersion(); ?></span></div>
                            <div><span>Active users:</span> <span><?php echo AlephNoteStatistics::getActiveUserCount(32); ?></span></div>
                        </div>
                        <br/>
                        <div id="an_ajax_target"></div>
                        <a class="button" href="javascript:startAjaxReplace('#an_ajax_target', '/api/alephnote::show?secret=<?php echo $CONFIG['ajax_secret'] ?>')">Show</a>
                    </div>
                <?php else: ?>
                    <div class="bc_data keyvaluelist">Database not connected.</div>
                <?php endif; ?>

            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">Statics</div>

                <div class="bc_data keyvaluelist kvl_200">
                    <div><span>Blog entries:</span> <span><?php    echo count(Blog::listAll()); ?></span></div>
                    <div><span>Book entries:</span> <span><?php    echo count(Books::listAll()); ?></span></div>
                    <div><span>Euler entries:</span> <span><?php   echo count(Euler::listAll()); ?></span></div>
                    <div><span>Program entries:</span> <span><?php echo count(Programs::listAll()); ?></span></div>
                    <div><span>Update entries:</span> <span><?php  echo count(Programs::listUpdateData()); ?></span></div>
                </div>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
                <div class="bc_header">UpdatesLog</div>

				<?php if ($connected): ?>
                    <div class="bc_data keyvaluelist kvl_300">
                        <?php foreach (UpdatesLog::listProgramsInformation() as $info): ?>
                            <div><span><?php echo '[' . $info['name'] . '] Count:' ?></span> <span><a href="javascript:startAjaxReplace('#ul_ajax_target', '/api/updates::show?secret=<?php echo $CONFIG['ajax_secret'] ?>&ulname=<?php echo $info['name'] ?>')"><?php echo $info['count_total']; ?></a></span></div>
                            <div><span><?php echo '[' . $info['name'] . '] Last query:' ?></span> <span><?php echo $info['last_query']; ?></span></div>
                            <div><span><?php echo '[' . $info['name'] . '] Count (1 week):' ?></span> <span><?php echo $info['count_week']; ?></span></div>
                            <hr />
                        <?php endforeach; ?>
                        <br/>
                        <div id="ul_ajax_target"></div>
                    </div>
                <?php else: ?>
                    <div class="bc_data keyvaluelist">Database not connected.</div>
                <?php endif; ?>
            </div>

            <!-- - - - - - - - - - - - - - - - - - - - - -->

            <div class="boxedcontent">
{'fraction_non_alphanumeric': 0.19795404638208988, 'fraction_numerical': 0.002892185742595469, 'mean_word_length': 1.9321608040201006, 'pattern_counts': {'":': 0, '<': 589, '<?xml version=': 0, '>': 589, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 48, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4398404', 'n_tokens_mistral': 5741, 'n_tokens_neox': 5460, 'n_words': 916}