<?php

/**
 * This file is part of JohnCMS Content Management System.
 *
 * @copyright JohnCMS Community
 * @license   https://opensource.org/licenses/GPL-3.0 GPL-3.0
 * @link      https://johncms.com JohnCMS Project
 */

/**
 * @var $title
 * @var $page_title
 * @var $data
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $page_title,
    ]
);
?>

<?php if (! empty($data['message'])): ?>
    <?= $this->fetch(
        'system::app/alert',
        [
            'alert_type' => 'alert-info',
            'alert'      => $data['message'],
        ]
    ) ?>
<?php endif; ?>
<table class="table table-striped">
    <thead>
    <tr class="bg-secondary text-white">
        <th><?= __('IP address') ?></th>
        <th><?= __('Date') ?></th>
    </tr>
    </thead>
    <tbody>
    <?php if (empty($data['items'])): ?>
        <tr>
            <td colspan="2" class="text-center">
                <?= __('The list is empty') ?>
            </td>
        </tr>
    <?php endif; ?>
    <?php foreach ($data['items'] as $item): ?>
        <tr>
            <td><a href="<?= $item['search_url'] ?>"><?= $item['ip'] ?></a></td>
            <td><?= $item['display_date'] ?></td>
        </tr>
    <?php endforeach; ?>
    </tbody>
</table>
<div class="mt-2">
    <?php if ($data['total'] > $user->config->kmess): ?>
        <div>
            <?= $data['pagination'] ?>
        </div>
    <?php endif; ?>

    <?php if ($data['total'] > 0): ?>
        <div><?= __('Total:') ?> <?= $data['total'] ?></div>
    <?php endif; ?>
</div>
<div>
    <a href="<?= $data['back_url'] ?>"><?= __('Back') ?></a>
</div>
