<div class="pi-article-module">
    <div class="clearfix pi-block-header">
        <h3><?php echo $this->escape($title); ?></h3>
    </div>
    <hr>
    <div class="topic-list-content">
        <?php foreach ($topics as $row) {
            $eachCount = isset($count[$row['id']]) ? $count[$row['id']] : 0;
            ?>
            <div class="media">
                <img class="float-left" src="<?php echo Pi::url($row['image']); ?>">
                <div class="media-body">
                    <div class="col-md-10">
                        <a target="_blank" href="<?php echo $this->escape($row['url']); ?>"
                           title="<?php echo $this->escape($row['title']); ?>"
                           style="font-size: 14px; font-weight: bold">
                            <?php echo $this->escape($row['title']); ?>
                        </a>
                        <div class="text-muted" style="font-size: 12px">
                            <span><?php echo sprintf(__('Created at %s'), _date($row['time_create'])); ?></span>
                            <span style="margin-left: 10px">
                            <?php echo isset($lastAdded[$row['id']])
                                ? sprintf(__('Last added at %s', _date($lastAdded[$row['id']])))
                                : ''; ?>
                        </span>
                        </div>
                        <div class="text-muted" style="margin-top: 5px; font-size: 12px">
                            <p><?php echo $this->escape($row['description']); ?></p>
                        </div>
                    </div>
                    <span class="float-right col-md-2" style="text-align: right">
                    <a href="<?php echo $this->url($route, ['topic' => $row['slug'] ?: $row['id'], 'list' => 'all']); ?>">
                        <?php echo $this->escape($eachCount) . __(' articles'); ?>
                    </a>
                </span>
                </div>
            </div>
            <hr>
        <?php } ?>
    </div>
</div>
<?php
echo $this->paginationControl(
    $paginator,
    'Sliding',
    'paginator.phtml',
    ['class' => 'pagination-centered']
);
?>
