<?php require_once('../Connections/telmanik_press.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_delete_pages = 10;
$pageNum_delete_pages = 0;
if (isset($_GET['pageNum_delete_pages'])) {
  $pageNum_delete_pages = $_GET['pageNum_delete_pages'];
}
$startRow_delete_pages = $pageNum_delete_pages * $maxRows_delete_pages;

mysql_select_db($database_telmanik_press, $telmanik_press);
$query_delete_pages = "SELECT * FROM pages WHERE id >= 2";
$query_limit_delete_pages = sprintf("%s LIMIT %d, %d", $query_delete_pages, $startRow_delete_pages, $maxRows_delete_pages);
$delete_pages = mysql_query($query_limit_delete_pages, $telmanik_press) or die(mysql_error());
$row_delete_pages = mysql_fetch_assoc($delete_pages);

if (isset($_GET['totalRows_delete_pages'])) {
  $totalRows_delete_pages = $_GET['totalRows_delete_pages'];
} else {
  $all_delete_pages = mysql_query($query_delete_pages);
  $totalRows_delete_pages = mysql_num_rows($all_delete_pages);
}
$totalPages_delete_pages = ceil($totalRows_delete_pages/$maxRows_delete_pages)-1;

$queryString_delete_pages = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_delete_pages") == false && 
        stristr($param, "totalRows_delete_pages") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_delete_pages = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_delete_pages = sprintf("&totalRows_delete_pages=%d%s", $totalRows_delete_pages, $queryString_delete_pages);
?>
<?php require("assets/wrapper/header.php"); ?>
<div class="mainlayout">
 
 <div id="edithead"><div id="editload">
  <p>&nbsp;</p>
  <?php echo $translate->__('Delete Pages');?> - 
   <p>&nbsp;</p><form action="" method="get" name="delete">
   <?php do { ?>
   
	
<?php echo $translate->__('Page Name:')?>	<?php echo $row_delete_pages['page_name']; ?> <BR /><?php echo $translate->__('Page Title:');?><?php echo $row_delete_pages['page_title']; ?><BR /><button onclick="window.location='delete_pages_confirm.php?id=<?php echo $row_delete_pages['id']; ?>&amp;lang<?php echo $output;?>'; return false;" class="submit"><?php echo $translate->__('Delete');?></button></p>
     
     
     <?php } while ($row_delete_pages = mysql_fetch_assoc($delete_pages)); ?>
   </form>
<?php echo $translate->__('Records');?> <?php echo ($startRow_delete_pages + 1) ?> <?php echo $translate->__('to');?> <?php echo min($startRow_delete_pages + $maxRows_delete_pages, $totalRows_delete_pages) ?> <?php echo $translate->__('of');?> <?php echo $totalRows_delete_pages ?>
<table border="0">
  <tr>
    <td><?php if ($pageNum_delete_pages > 0) { // Show if not first page ?>
        <a href="<?php printf("%s?pageNum_delete_pages=%d%s", $currentPage, 0, $queryString_delete_pages); ?>"><?php echo $translate->__('First');?></a>
        <?php } // Show if not first page ?></td>
    <td><?php if ($pageNum_delete_pages > 0) { // Show if not first page ?>
        <a href="<?php printf("%s?pageNum_delete_pages=%d%s", $currentPage, max(0, $pageNum_delete_pages - 1), $queryString_delete_pages); ?>"><?php echo $translate->__('Previous');?></a>
        <?php } // Show if not first page ?></td>
    <td><?php if ($pageNum_delete_pages < $totalPages_delete_pages) { // Show if not last page ?>
        <a href="<?php printf("%s?pageNum_delete_pages=%d%s", $currentPage, min($totalPages_delete_pages, $pageNum_delete_pages + 1), $queryString_delete_pages); ?>"><?php echo $translate->__('Next');?></a>
        <?php } // Show if not last page ?></td>
    <td><?php if ($pageNum_delete_pages < $totalPages_delete_pages) { // Show if not last page ?>
        <a href="<?php printf("%s?pageNum_delete_pages=%d%s", $currentPage, $totalPages_delete_pages, $queryString_delete_pages); ?>"><?php echo $translate->__('Last');?></a>
        <?php } // Show if not last page ?></td>
  </tr>
</table><p>&nbsp;</p>
   <p>&nbsp;</p>
 </div></div></div>
</div>
<?php require("assets/wrapper/footer.php"); ?>
<?php
mysql_free_result($delete_pages);
?>
