<div class="blog-class">
    <div class="blogs">
        <?php foreach($Blogs as $blog) { ?>
            <div class="blog-item" data-aos="fade-up">
                <div class="image">
                    <img src="<?=base_url('assets/images/blog/').$blog->Imagine?>" alt="">
                </div>
                <div class="content">
                    <div class="title-blog" data-aos="fade-up">
                        <p><?= $blog->Titlu ?></p>
                        <span><?= (new DateTime($blog->DataCreare))->format('d.m.Y') ?></span>
                    </div>
                    <div class="content-blog" data-aos="fade-up">
                        <p><?= $blog->Descriere ?></p>
                    </div>
                    <div class="footer-blog" data-aos="fade-up">
                        <a href="<?= base_url("blog-page/".$blog->Slug) ?>">Vezi mai mult</a>
                    </div>
                </div>
            </div>
        <?php } ?>
    </div>
    <br />
    <div class="pagination">
        <button onclick="prevPage()"> &lt; </button>
        <span><?= $Page ?></span>
        <button onclick="nextPage()"> &gt;</button>
    </div>
</div>


<script>
    AOS.init();
    let page = <?= $Page ?>;
    let pages = <?= $Pages ?>;



    function nextPage() {
        let nextPage = page+1;
        if (nextPage > pages) return;
        let url = '<?= base_url("blog-list") ?>/'+nextPage;
        window.location.href = url;
    }

    function prevPage() {
        let prevPage = page - 1;
        if (prevPage <= 0) return;
        let url = '<?= base_url("blog-list") ?>/' + prevPage;
        window.location.href = url;
    }

</script>