summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/common.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/inc/common.php b/inc/common.php
index 8fe797187..8ad55efff 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -733,7 +733,11 @@ function getRecents($first,$num,$ns='',$flags=0){
// now read backwards into buffer
while($pos > 0){
$pos -= $csz; // seek to previous chunk...
- if($pos < 0) $pos = 0; // ...or rest of file
+ if($pos < 0) { // ...or rest of file
+ $csz += $pos;
+ $pos = 0;
+ }
+
fseek($fh,$pos);
$buf = fread($fh,$csz).$buf; // prepend to buffer