<section class="wpo-blog-pg-section blog-pg-left-sidebar section-padding">
            <div class="container">
                <div class="row">
                    <div class="col col-lg-8 order-lg-2">
                        <div class="wpo-blog-content">
                        
                         <?php
            $limit = 4;

$query = $db->prepare("SELECT * FROM haberler where durum='on'");
$query->execute();

$total_results = $query->rowCount();
$total_pages = ceil($total_results / $limit);

if (isset($_GET["page"])) {
    $page = $_GET["page"];
} else {
    $page = 1;
}

$starting_limit = (($page - 1) * $limit);
$sec=$db->query("SELECT * FROM haberler where durum='on' ORDER BY id DESC LIMIT $starting_limit,$limit",PDO::FETCH_ASSOC);
if($sec->rowCount()){foreach($sec as $sonuc){
			?>


                            <div class="post format-standard-image">
                                <div class="entry-media">
                                    <img src="resimler/<?=$sonuc['resim']?>" alt="<?=$sonuc['adi']?>">
                                </div>
                                <div class="entry-meta">
                                    <ul>
                                        <li><i class="fi flaticon-user"></i> By <a href="#"><?=$ayar['site_title']?></a> </li>
                                       
                                        <li><i class="fi flaticon-calendar-1"></i> <?=$sonuc['tarih']?></li>
                                    </ul>
                                </div>
                                <div class="entry-details">
                                    <h3><a href="<?=$sonuc['seo']?>"><?=$sonuc['adi']?></a></h3>
                                    <p><?=$sonuc['onaciklama']?></p>
                                    <a href="<?=$sonuc['seo']?>" class="read-more">İnceleyin...</a>
                                </div>
                            </div>
                
                <?php } }?>
                            <div class="pagination-wrapper pagination-wrapper-left">
                                <ul class="pg-pagination">
                                     <?php
            $url=$_GET['page'];
            ?> <?php for ($i = 1; $i <= $total_pages; $i++): ?>
                                    <li <?php if($url==$i){?>class="active" <?php }?>><a href="?page=<?= $i ?>"><?= $i ?></a></li>
                                   <?php endfor; ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="col col-lg-4 order-lg-1">
                        <div class="blog-sidebar">
                            
                          
                          
                            <div class="widget recent-post-widget">
                                <h3>Popüler Bloglar </h3>
                                <div class="posts">
                                
                                                                     <?php
                    $cek=$db->query("select * from haberler where durum='on' order by rand()")->fetchAll(PDO::FETCH_ASSOC);
					foreach($cek as $goster){
					?>
                                    <div class="post">
                                        <div class="img-holder">
                                            <img src="resimler/<?=$goster['resim']?>" alt="<?=$goster['adi']?>">
                                        </div>
                                        <div class="details">
                                            <h4><a href="<?=$goster['seo']?>"><?=$goster['adi']?></a></h4>
                                            <span class="date"><?=$goster['tarih']?> </span>
                                        </div>
                                    </div><?php }?>
                                   
                                  
                                </div>
                            </div>
                           
                            
                        </div>
                    </div>
                </div>
            </div> 
        </section>