aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr
diff options
context:
space:
mode:
Diffstat (limited to 'ratatoeskr')
-rw-r--r--ratatoeskr/frontend.php5
-rw-r--r--ratatoeskr/sys/models.php2
2 files changed, 5 insertions, 2 deletions
diff --git a/ratatoeskr/frontend.php b/ratatoeskr/frontend.php
index c1daeb9..1739f8b 100644
--- a/ratatoeskr/frontend.php
+++ b/ratatoeskr/frontend.php
@@ -271,7 +271,10 @@ $ste->register_tag("articles_get", function($ste, $params, $sub)
if(isset($params["perpage"]))
{
if(isset($params["maxpage"]))
- $ste->set_var_by_name($params["maxpage"], ceil(count($result) / $params["perpage"]));
+ {
+ $maxpage = ceil(count($result) / $params["perpage"]);
+ $ste->set_var_by_name($params["maxpage"], $maxpage == 0 ? 1 : $maxpage);
+ }
$page = isset($params["page"]) ? $params["page"] : 1;
$result = array_slice($result, ($page - 1) * $params["perpage"], $params["perpage"]);
}
diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php
index c0320fa..627fa89 100644
--- a/ratatoeskr/sys/models.php
+++ b/ratatoeskr/sys/models.php
@@ -1024,7 +1024,7 @@ class Style
*/
public function save()
{
- $result = qdb("SELECT COUNT(*) AS `n` FROM `PREFIX_styles` WHERE `name` = '%' AND `id` != %d", $this->name, $this->id);
+ $result = qdb("SELECT COUNT(*) AS `n` FROM `PREFIX_styles` WHERE `name` = '%s' AND `id` != %d", $this->name, $this->id);
$sqlrow = mysql_fetch_assoc($result);
if($sqlrow["n"] > 0)
throw new AlreadyExistsError();