<?php include "includes/header.php"; ?>
<?php include "includes/head_ic.php"; ?>
<?php
$page_header_setting = $db->prepare("select * from page_header where page_id='video' order by id");
$page_header_setting->execute();
$pagehead = $page_header_setting->fetch(PDO::FETCH_ASSOC);
?>
<?php
$videosettings = $db->prepare("select * from video_ayar where id=:id");
$videosettings->execute(array(
    'id' => '1'
));
$videoset = $videosettings->fetch(PDO::FETCH_ASSOC);


$Sayfa = @intval($_GET['page']); if(!$Sayfa) $Sayfa = 1;
$Say = $db->query("select * from video where durum='1' and dil='$_SESSION[dil]' order by sira ASC");
$ToplamVeri = $Say->rowCount();
$Limit = 12;
$Sayfa_Sayisi = ceil($ToplamVeri/$Limit); if($Sayfa > $Sayfa_Sayisi){$Sayfa = 1;}
$Goster = $Sayfa * $Limit - $Limit;
$GorunenSayfa = 5;
$video_list = $db->query("select * from video where durum='1' and dil='$_SESSION[dil]' order by sira ASC limit $Goster,$Limit");
$VideoAl = $video_list->fetchAll(PDO::FETCH_ASSOC);
?>
    <title><?php echo ucwords_tr($diller['video']) ?> | <?php echo $ayar['site_baslik']?></title>
    <meta name="description" content="<?php echo"$videoset[meta_desc]" ?>">
    <meta name="keywords" content="<?php echo"$videoset[tags]" ?>">
    <meta name="news_keywords" content="<?php echo"$videoset[tags]" ?>">
    <meta name="author" content="<?php echo"$ayar[site_baslik]" ?>" />
    <meta itemprop="author" content="<?php echo"$ayar[site_baslik]" ?>" />
    <meta name="robots" content="index follow">
    <meta name="googlebot" content="index follow">
    <meta property="og:type" content="website" />

    <main class="main-content">
        <!--== Start Page Header Area Wrapper ==-->
        <div class="page-header-area" data-bg-img="tema/img/photos/bg1.webp">
            <div class="container pt--0 pb--0">
                <div class="row">
                    <div class="col-12">
                        <div class="page-header-content">
                            <h2 class="title"><?php echo ucwords_tr($diller['video']) ?></h2>
                            <nav class="breadcrumb-area">
                                <ul class="breadcrumb">
                                    <li><a href="index.html"><?php echo $diller['anasayfa'] ?></a></li>
                                    <li class="breadcrumb-sep">//</li>
                                    <li><?php echo ucwords_tr($diller['video']) ?></li>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--== End Page Header Area Wrapper ==-->

        <!--== Start Product Area Wrapper ==-->
        <section class="product-area">
            <div class="container">
                <div class="row justify-content-between">

                    <div class="col-12">
                        <div class="row">
                            <div class="col-12">
                                <div class="tab-content" id="nav-tabContent">
                                    <div class="row">

                                        <?php foreach ($VideoAl as $video) {?>
                                            <div class="col-sm-6 col-xl-4">
                                                <!--== Start Product Item ==-->
                                                <div class="product-item">
                                                    <div class="product-thumb">
                                                        <a href="video/<?=$video['id']?>/<?=seo($video['baslik'])?>">
                                                            <img style="width: 100%;height: 280px;object-fit: cover;" src="images/videos/<?=$video['gorsel']?>"  alt="<?=$video['baslik']?>">
                                                        </a>
                                                    </div>
                                                    <div class="product-info">
                                                        <h4 class="title"><a href="video/<?=$video['id']?>/<?=seo($video['baslik'])?>"><?=$video['baslik']?></a></h4>
                                                    </div>
                                                </div>
                                                <!--== End prPduct Item ==-->
                                            </div>
                                        <?php }?>

                                        <?php if($Sayfa >= 1){?>
                                        <nav aria-label="Page navigation example" style="margin-top: 50px;">
                                            <ul class="pagination pagination-sm justify-content-center">
                                                <?php } ?>

                                                <?php if($Sayfa > 1){?>

                                                    <li class="page-item"><a class="page-link" href="video-galeri/1"><?=$diller['sayfalama-ilk']?></a></li>
                                                    <li class="page-item"><a class="page-link" href="video-galeri/<?=$Sayfa - 1?>"><?=$diller['sayfalama-onceki']?></a></li>

                                                <?php } ?>
                                                <?php
                                                for($i = $Sayfa - $GorunenSayfa; $i < $Sayfa + $GorunenSayfa +1; $i++){ if($i > 0 and $i <= $Sayfa_Sayisi){
                                                    if($i == $Sayfa){
                                                        echo '    
    
                            <li class="page-item active" aria-current="page">
                              <a class="page-link" href="video-galeri/'.$i.'">'.$i.'<span class="sr-only">(current)</span></a>
                            </li>
                            
                            ';
                                                    }else{
                                                        echo '
                    <li class="page-item"><a class="page-link" href="video-galeri/'.$i.'">'.$i.'</a></li>
                    ';
                                                    }
                                                }
                                                }
                                                ?>

                                                <?php if($video_list->rowCount() <=0) { } else { ?>
                                                    <?php if($Sayfa != $Sayfa_Sayisi){?>

                                                        <li class="page-item"><a class="page-link" href="video-galeri/<?=$Sayfa + 1?>"><?=$diller['sayfalama-sonraki']?></a></li>
                                                        <li class="page-item"><a class="page-link" href="video-galeri/<?=$Sayfa_Sayisi?>"><?=$diller['sayfalama-son']?></a></li>


                                                    <?php }} ?>

                                                <?php if($Sayfa >= 1){?>
                                            </ul>
                                        </nav>
                                    <?php } ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--== End Product Area Wrapper ==-->
    </main>


<?php include "includes/footer.php"; ?>