mirror of https://github.com/itflow-org/itflow
40 lines
759 B
PHP
40 lines
759 B
PHP
<?php
|
|
/*
|
|
* Pagination - Head
|
|
* Sets the paging/sort for use in limit/order by
|
|
* Sets the default search query from GET to $q
|
|
*
|
|
* Should not be accessed directly, but called from other pages
|
|
*/
|
|
|
|
// Paging
|
|
if(isset($_GET['p'])){
|
|
$p = intval($_GET['p']);
|
|
$record_from = (($p)-1)*$_SESSION['records_per_page'];
|
|
$record_to = $_SESSION['records_per_page'];
|
|
}else{
|
|
$record_from = 0;
|
|
$record_to = $_SESSION['records_per_page'];
|
|
$p = 1;
|
|
}
|
|
|
|
// Order
|
|
if(isset($_GET['o'])){
|
|
if($_GET['o'] == 'ASC'){
|
|
$o = "ASC";
|
|
$disp = "DESC";
|
|
}else{
|
|
$o = "DESC";
|
|
$disp = "ASC";
|
|
}
|
|
}else{
|
|
$o = "ASC";
|
|
$disp = "DESC";
|
|
}
|
|
|
|
// Search
|
|
if(isset($_GET['q'])){
|
|
$q = strip_tags(mysqli_real_escape_string($mysqli,trim($_GET['q'])));
|
|
}else{
|
|
$q = "";
|
|
} |