]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/poche/Poche.class.php
Merge branch 'dev' of github.com:wallabag/wallabag into dev
[github/wallabag/wallabag.git] / inc / poche / Poche.class.php
index 4b85d52fb3d23c2868ce57f57bd8c0308400bcdf..9424e3ff7a7175edb603fb4c04b04e23b6c98870 100755 (executable)
@@ -393,13 +393,13 @@ class Poche
                 
             /* For some unknown reason I can't get displayView() to work here (it redirects to home view afterwards). So here's a dirty fix which redirects directly to URL */
             case 'random':
-                $count = $this->store->getEntriesByViewCount($view, $this->user->getId());
-                $id_query = $this->store->getRandomId(rand(1,$count)-1, $this->user->getId());
-                $id = $id_query[0];
                 Tools::logm('get a random article');
-                Tools::redirect('?view=view&id=' . $id[0]);
-                
-                //$this->displayView('view', $id);
+                if ($this->store->getRandomId($this->user->getId())) {
+                    $id_array = $this->store->getRandomId($this->user->getId());
+                    $id = $id_array[0];
+                    Tools::redirect('?view=view&id=' . $id[0]);
+                    Tools::logm('got the article with id ' . $id[0]);
+                }
                 break;
             default:
                 break;