Index: /branches/release-40/php/lib/mtdb_base.php
===================================================================
--- /branches/release-40/php/lib/mtdb_base.php (revision 2521)
+++ /branches/release-40/php/lib/mtdb_base.php (revision 2588)
@@ -493,11 +493,11 @@
             $args['lastn'] = $args['limit'];
         } elseif (!isset($args['days']) && !isset($args['lastn'])) {
-        #    if ($days = $blog['blog_days_on_index']) {
-        #        if (!isset($args['recently_commented_on'])) {
-        #            $args['days'] = $days;
-        #        }
-        #    } elseif ($posts = $blog['blog_entries_on_index']) {
-        #        $args['lastn'] = $posts;
-        #    }
+            if ($days = $blog['blog_days_on_index']) {
+                if (!isset($args['recently_commented_on'])) {
+                    $args['days'] = $days;
+                }
+            } elseif ($posts = $blog['blog_entries_on_index']) {
+                $args['lastn'] = $posts;
+            }
         }
         if ($args['limit'] == 'auto') {
@@ -898,6 +898,6 @@
             $no_resort = 1;
         } elseif ( !is_null($total_count) ) {
-            $orig_limit = $limit;
-            $orig_offset = $offset;
+            $orig_offset = $post_select_offset ? $post_select_offset : $orig_offset;
+            $orig_limit = $post_select_limit ? $post_select_limit : $limit;
         } else {
             $sql = $this->apply_limit_sql($sql . " <LIMIT>", $limit, $offset);
