From: <be...@us...> - 2012-05-19 10:27:15
|
Revision: 9552 http://xoops.svn.sourceforge.net/xoops/?rev=9552&view=rev Author: beckmi Date: 2012-05-19 10:27:09 +0000 (Sat, 19 May 2012) Log Message: ----------- Fixing division by zero in: $total_pages = ceil($this->total / $this->perpage); Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/pagenav.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/pagenav.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/pagenav.php 2012-05-19 10:26:22 UTC (rev 9551) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/pagenav.php 2012-05-19 10:27:09 UTC (rev 9552) @@ -85,34 +85,36 @@ if ($this->total <= $this->perpage) { return $ret; } - $total_pages = ceil($this->total / $this->perpage); - if ($total_pages > 1) { - $ret .= '<div id="xo-pagenav">'; - $prev = $this->current - $this->perpage; - if ($prev >= 0) { - $ret .= '<a class="xo-pagarrow" href="' . $this->url . $prev . $this->extra . '"><u>«</u></a> '; - } - $counter = 1; - $current_page = intval(floor(($this->current + $this->perpage) / $this->perpage)); - while ($counter <= $total_pages) { - if ($counter == $current_page) { - $ret .= '<strong class="xo-pagact" >(' . $counter . ')</strong> '; - } elseif (($counter > $current_page - $offset && $counter < $current_page + $offset) || $counter == 1 || $counter == $total_pages) { - if ($counter == $total_pages && $current_page < $total_pages - $offset) { - $ret .= '... '; + if(($this->total != 0) && ($this->perpage != 0)) { + $total_pages = ceil($this->total / $this->perpage); + if ($total_pages > 1) { + $ret .= '<div id="xo-pagenav">'; + $prev = $this->current - $this->perpage; + if ($prev >= 0) { + $ret .= '<a class="xo-pagarrow" href="' . $this->url . $prev . $this->extra . '"><u>«</u></a> '; + } + $counter = 1; + $current_page = intval(floor(($this->current + $this->perpage) / $this->perpage)); + while ($counter <= $total_pages) { + if ($counter == $current_page) { + $ret .= '<strong class="xo-pagact" >(' . $counter . ')</strong> '; + } elseif (($counter > $current_page - $offset && $counter < $current_page + $offset) || $counter == 1 || $counter == $total_pages) { + if ($counter == $total_pages && $current_page < $total_pages - $offset) { + $ret .= '... '; + } + $ret .= '<a class="xo-counterpage" href="' . $this->url . (($counter - 1) * $this->perpage) . $this->extra . '">' . $counter . '</a> '; + if ($counter == 1 && $current_page > 1 + $offset) { + $ret .= '... '; + } } - $ret .= '<a class="xo-counterpage" href="' . $this->url . (($counter - 1) * $this->perpage) . $this->extra . '">' . $counter . '</a> '; - if ($counter == 1 && $current_page > 1 + $offset) { - $ret .= '... '; - } + $counter ++; } - $counter ++; + $next = $this->current + $this->perpage; + if ($this->total > $next) { + $ret .= '<a class="xo-pagarrow" href="' . $this->url . $next . $this->extra . '"><u>»</u></a> '; + } + $ret .= '</div> '; } - $next = $this->current + $this->perpage; - if ($this->total > $next) { - $ret .= '<a class="xo-pagarrow" href="' . $this->url . $next . $this->extra . '"><u>»</u></a> '; - } - $ret .= '</div> '; } return $ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |