<?php
/* Smarty version 4.5.6, created on 2025-12-20 15:56:38
  from '/var/www/html/tivi/panel/templates/admin/system_logs.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.6',
  'unifunc' => 'content_6946b9266b43f7_27485044',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '59148b2e1c951a40647f7ef4171aa6495bbcc88d' => 
    array (
      0 => '/var/www/html/tivi/panel/templates/admin/system_logs.tpl',
      1 => 1766236217,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_6946b9266b43f7_27485044 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_loadInheritance();
$_smarty_tpl->inheritance->init($_smarty_tpl, true);
?>


<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_7946723816946b9266ac1e6_04926027', "content");
?>


<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_2088892636946b9266b3f36_18635118', "scripts");
?>

<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl, "layout.tpl");
}
/* {block "content"} */
class Block_7946723816946b9266ac1e6_04926027 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content' => 
  array (
    0 => 'Block_7946723816946b9266ac1e6_04926027',
  ),
);
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/var/www/html/tivi/vendor/smarty/smarty/libs/plugins/modifier.number_format.php','function'=>'smarty_modifier_number_format',),));
?>

<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h4 class="mb-1">Logi systemowe</h4>
            <p class="text-muted mb-0">Przeglądaj logi serwera i aplikacji</p>
        </div>
        <div class="btn-group">
            <form method="post" action="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/admin/clear-logs" class="d-inline">
                <input type="hidden" name="csrf_token" value="<?php echo $_smarty_tpl->tpl_vars['csrfToken']->value;?>
">
                <input type="hidden" name="type" value="app">
                <button type="submit" class="btn btn-outline-warning" onclick="return confirm('Wyczyścić logi aplikacji?')">
                    <i class="bi bi-trash me-1"></i>Wyczyść logi aplikacji
                </button>
            </form>
            <form method="post" action="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/admin/clear-logs" class="d-inline ms-2">
                <input type="hidden" name="csrf_token" value="<?php echo $_smarty_tpl->tpl_vars['csrfToken']->value;?>
">
                <input type="hidden" name="type" value="database">
                <button type="submit" class="btn btn-outline-danger" onclick="return confirm('Wyczyścić stare wpisy z bazy?')">
                    <i class="bi bi-database-x me-1"></i>Wyczyść stare z bazy
                </button>
            </form>
        </div>
    </div>

    <div class="row">
        <!-- Lista plików logów -->
        <div class="col-md-3">
            <div class="card">
                <div class="card-header">
                    <h6 class="card-title mb-0"><i class="bi bi-folder me-2"></i>Pliki logów</h6>
                </div>
                <div class="list-group list-group-flush">
                    <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['logFiles']->value, 'file', false, 'key');
$_smarty_tpl->tpl_vars['file']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['key']->value => $_smarty_tpl->tpl_vars['file']->value) {
$_smarty_tpl->tpl_vars['file']->do_else = false;
?>
                    <a href="<?php echo $_smarty_tpl->tpl_vars['baseUrl']->value;?>
/admin/system-logs?type=<?php echo $_smarty_tpl->tpl_vars['key']->value;?>
&lines=<?php echo $_smarty_tpl->tpl_vars['lines']->value;?>
" 
                       class="list-group-item list-group-item-action d-flex justify-content-between align-items-center <?php if ($_smarty_tpl->tpl_vars['selectedType']->value == $_smarty_tpl->tpl_vars['key']->value) {?>active<?php }?>">
                        <span>
                            <i class="<?php echo $_smarty_tpl->tpl_vars['file']->value['icon'];?>
 me-2"></i><?php echo $_smarty_tpl->tpl_vars['file']->value['name'];?>

                        </span>
                        <?php if ($_smarty_tpl->tpl_vars['file']->value['exists']) {?>
                        <span class="badge bg-<?php if ($_smarty_tpl->tpl_vars['selectedType']->value == $_smarty_tpl->tpl_vars['key']->value) {?>light text-dark<?php } else { ?>secondary<?php }?>">
                            <?php echo smarty_modifier_number_format(($_smarty_tpl->tpl_vars['file']->value['size']/1024),0);?>
 KB
                        </span>
                        <?php } else { ?>
                        <span class="badge bg-danger">Brak</span>
                        <?php }?>
                    </a>
                    <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                </div>
            </div>

            <!-- Opcje -->
            <div class="card mt-3">
                <div class="card-header">
                    <h6 class="card-title mb-0"><i class="bi bi-sliders me-2"></i>Opcje</h6>
                </div>
                <div class="card-body">
                    <form method="get">
                        <input type="hidden" name="type" value="<?php echo $_smarty_tpl->tpl_vars['selectedType']->value;?>
">
                        <div class="mb-3">
                            <label class="form-label">Liczba linii</label>
                            <select name="lines" class="form-select" onchange="this.form.submit()">
                                <option value="50" <?php if ($_smarty_tpl->tpl_vars['lines']->value == 50) {?>selected<?php }?>>50</option>
                                <option value="100" <?php if ($_smarty_tpl->tpl_vars['lines']->value == 100) {?>selected<?php }?>>100</option>
                                <option value="200" <?php if ($_smarty_tpl->tpl_vars['lines']->value == 200) {?>selected<?php }?>>200</option>
                                <option value="500" <?php if ($_smarty_tpl->tpl_vars['lines']->value == 500) {?>selected<?php }?>>500</option>
                                <option value="1000" <?php if ($_smarty_tpl->tpl_vars['lines']->value == 1000) {?>selected<?php }?>>1000</option>
                            </select>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <!-- Zawartość logów -->
        <div class="col-md-9">
            <div class="card">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h6 class="card-title mb-0">
                        <i class="bi bi-terminal me-2"></i>
                        <?php echo (($tmp = $_smarty_tpl->tpl_vars['logFiles']->value[$_smarty_tpl->tpl_vars['selectedType']->value]['name'] ?? null)===null||$tmp==='' ? 'Log' ?? null : $tmp);?>

                    </h6>
                    <?php if ($_smarty_tpl->tpl_vars['selectedFile']->value) {?>
                    <small class="text-muted"><?php echo $_smarty_tpl->tpl_vars['selectedFile']->value;?>
</small>
                    <?php }?>
                </div>
                <div class="card-body p-0">
                    <pre class="log-viewer mb-0" id="logContent"><?php echo (($tmp = $_smarty_tpl->tpl_vars['content']->value ?? null)===null||$tmp==='' ? 'Brak danych lub plik niedostępny' ?? null : $tmp);?>
</pre>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
.log-viewer {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    font-size: 0.75rem;
    line-height: 1.4;
    max-height: 600px;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
</style>
<?php
}
}
/* {/block "content"} */
/* {block "scripts"} */
class Block_2088892636946b9266b3f36_18635118 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'scripts' => 
  array (
    0 => 'Block_2088892636946b9266b3f36_18635118',
  ),
);
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
?>

<?php echo '<script'; ?>
>
// Scroll na dół
document.getElementById('logContent').scrollTop = document.getElementById('logContent').scrollHeight;
<?php echo '</script'; ?>
>
<?php
}
}
/* {/block "scripts"} */
}
