Fix notice,warning, and errors seen in log file last week, mainly related to making sure session id is a positive int, and when image captchas being used but still hit a tiny bit of text captcha code, a=chris

Chris Pollett [2019-06-28 17:Jun:th]
Fix notice,warning, and errors seen in log file last week, mainly related to making sure session id is a positive int, and when image captchas being used but still hit a tiny bit of text captcha code, a=chris
Filename
src/configs/Createdb.php
src/configs/PublicHelpPages.php
src/controllers/AdminController.php
src/controllers/Controller.php
src/controllers/GroupController.php
src/controllers/RegisterController.php
src/controllers/SettingsController.php
src/controllers/components/SocialComponent.php
src/data/public_default.db
src/executables/ArcTool.php
src/executables/QueueServer.php
src/library/IndexDictionary.php
src/library/Utility.php
src/library/WikiParser.php
src/locale/ar/configure.ini
src/locale/bn/configure.ini
src/locale/de/configure.ini
src/locale/en_US/configure.ini
src/locale/es/configure.ini
src/locale/fa/configure.ini
src/locale/fr_FR/configure.ini
src/locale/he/configure.ini
src/locale/hi/configure.ini
src/locale/in_ID/configure.ini
src/locale/it/configure.ini
src/locale/ja/configure.ini
src/locale/kn/configure.ini
src/locale/ko/configure.ini
src/locale/nl/configure.ini
src/locale/pl/configure.ini
src/locale/pt/configure.ini
src/locale/ru/configure.ini
src/locale/te/configure.ini
src/locale/th/configure.ini
src/locale/tr/configure.ini
src/locale/vi_VN/configure.ini
src/locale/zh_CN/configure.ini
src/models/CrawlModel.php
src/models/ProfileModel.php
src/views/GroupView.php
diff --git a/src/configs/Createdb.php b/src/configs/Createdb.php
index 4e01b5010..e8e9ce148 100755
--- a/src/configs/Createdb.php
+++ b/src/configs/Createdb.php
@@ -473,11 +473,11 @@ foreach ($media_sources as $media_source) {
 $db->execute("INSERT INTO CRAWL_MIXES VALUES (2, 'images', ".ROOT_ID.", -1)");
 $db->execute("INSERT INTO MIX_FRAGMENTS VALUES(2, 0, 1)");
 $db->execute("INSERT INTO MIX_COMPONENTS VALUES(
-    2, 0, 1, 1, 'media:image site:doc')");
+    2, 0, 1, 1, 'media:image')");
 $db->execute("INSERT INTO CRAWL_MIXES VALUES (3, 'videos', ".ROOT_ID.", -1)");
 $db->execute("INSERT INTO MIX_FRAGMENTS VALUES(3, 0, 1)");
 $db->execute("INSERT INTO MIX_COMPONENTS VALUES(
-    3, 0, 1, 1, 'media:video site:doc')");
+    3, 0, 1, 1, 'media:video')");
 $db->execute("INSERT INTO CRAWL_MIXES VALUES (4, 'news', ".ROOT_ID.", -1)");
 $db->execute("INSERT INTO MIX_FRAGMENTS VALUES(4, 0, 1)");
 $db->execute("INSERT INTO MIX_COMPONENTS VALUES(4, 0, 1, 1,
diff --git a/src/configs/PublicHelpPages.php b/src/configs/PublicHelpPages.php
index efb991a0d..a52f53313 100644
--- a/src/configs/PublicHelpPages.php
+++ b/src/configs/PublicHelpPages.php
@@ -2314,7 +2314,7 @@ END_HEAD_VARSYioop can be run in a single machine or multi-machine setting. In a

 <br />

-When someone enters a query into a Yioop set-up, they typically enter the query on the name server. The '''Use Filecache''' checkbox controls whether the query results are cached in a file so that they don't have to be recalculated when someone enters the same query again. The file cache is purged periodically so that it doesn't get too large. Sometimes it is useful, however, to know the file cache has just been cleared. The '''Clear Cache''' link clears both the file cache as well as the local DNS-IP of machines part of this Yioop instance.
+When someone enters a query into a Yioop set-up, they typically enter the query on the name server. The '''Use Filecache''' checkbox controls whether the query results are cached in a file so that they don't have to be recalculated when someone enters the same query again. The file cache is purged periodically so that it doesn't get too large. Sometimes it is useful, however, to know the file cache has just been cleared. The '''Clear Cache''' link clears both the file cache as well as the local domain name to IP address cache.
 EOD;
 $help_pages["en-US"]["Page_Byte_Ranges"] = <<< EOD
 page_type=standard
diff --git a/src/controllers/AdminController.php b/src/controllers/AdminController.php
index e2f3aabe2..09b58ff48 100755
--- a/src/controllers/AdminController.php
+++ b/src/controllers/AdminController.php
@@ -382,7 +382,8 @@ class AdminController extends Controller implements CrawlConstants
             if (!empty($_REQUEST['TOGGLE_ACTIVITIES'])) {
                 $_SESSION['HIDE_ACTIVITIES'] = (empty(
                     $_SESSION['HIDE_ACTIVITIES'])) ? true : false;
-                if (!empty($_SESSION['USER_ID'])) {
+                if (!empty($_SESSION['USER_ID']) &&
+                    L\positiveInt($_SESSION['USER_ID'])) {
                     $this->model("user")->setUserSession($_SESSION['USER_ID'],
                         $_SESSION);
                 }
diff --git a/src/controllers/Controller.php b/src/controllers/Controller.php
index bef3a1def..e7353fe95 100755
--- a/src/controllers/Controller.php
+++ b/src/controllers/Controller.php
@@ -1034,8 +1034,8 @@ abstract class Controller
     public function recordViewSession($page_id, $sub_path, $media_name)
     {
         $hash_id = L\crawlHash($page_id . $media_name . $sub_path);
-        if (empty($_SESSION['USER_ID']) || $_SESSION['USER_ID'] ==
-            C\PUBLIC_USER_ID || !empty($_REQUEST['t'])) {
+        if (empty($_SESSION['USER_ID'])||!L\positiveInt($_SESSION['USER_ID'])||
+            $_SESSION['USER_ID'] == C\PUBLIC_USER_ID || !empty($_REQUEST['t'])){
             return;
         }
         if (empty($_SESSION['seen_media']) ||
diff --git a/src/controllers/GroupController.php b/src/controllers/GroupController.php
index 82480277b..7ccb4951b 100644
--- a/src/controllers/GroupController.php
+++ b/src/controllers/GroupController.php
@@ -141,7 +141,8 @@ class GroupController extends Controller implements CrawlConstants
             $activity = "groupFeeds";
         }
         $_SESSION['HIDE_ACTIVITIES'] =  false;
-        if (!empty($_SESSION['USER_ID'])) {
+        if (!empty($_SESSION['USER_ID']) &&
+            L\positiveInt($_SESSION['USER_ID'])) {
             $this->model("user")->setUserSession($_SESSION['USER_ID'],
                 $_SESSION);
         }
diff --git a/src/controllers/RegisterController.php b/src/controllers/RegisterController.php
index 6ed58ce3d..c7492005e 100755
--- a/src/controllers/RegisterController.php
+++ b/src/controllers/RegisterController.php
@@ -136,7 +136,8 @@ class RegisterController extends Controller implements CrawlConstants
                 $this->captchas_qa[] = $register_view->captchas_qa[$i];
             }
         }
-        $num_so_far = count($this->captchas_qa);
+        $num_so_far = (!empty($this->captchas_qa) &&
+            is_array($this->captchas_qa)) ? count($this->captchas_qa) : 0;
         //If current locale didn't have enough questions fill in from default
         if ($num_so_far < self::NUM_CAPTCHA_QUESTIONS) {
             $captchas_qa = $register_view->captchas_qa;
@@ -146,7 +147,9 @@ class RegisterController extends Controller implements CrawlConstants
                     strpos($captcha_qa[2],"register_view_question") === false) {
                     $this->captchas_qa[] = $captcha_qa;
                     $num_so_far++;
-                    if ($num_so_far >= self::NUM_CAPTCHA_QUESTIONS) { break; }
+                    if ($num_so_far >= self::NUM_CAPTCHA_QUESTIONS) {
+                        break;
+                    }
                 }
             }
         }
diff --git a/src/controllers/SettingsController.php b/src/controllers/SettingsController.php
index a4467f718..9fce52ce1 100755
--- a/src/controllers/SettingsController.php
+++ b/src/controllers/SettingsController.php
@@ -136,7 +136,9 @@ class SettingsController extends Controller
             $data['its'] = $crawl_model->getCurrentIndexDatabaseName();
         }
         if ($changed_settings_flag) {
-            $this->model("user")->setUserSession($user, $_SESSION);
+            if (L\positiveInt($user)) {
+                $this->model("user")->setUserSession($user, $_SESSION);
+            }
             return $this->redirectWithMessage(
                 tl('settings_controller_settings_saved'),
                 ['return', 'oldc']);
diff --git a/src/controllers/components/SocialComponent.php b/src/controllers/components/SocialComponent.php
index ba79bfc0a..9c2cc3e62 100644
--- a/src/controllers/components/SocialComponent.php
+++ b/src/controllers/components/SocialComponent.php
@@ -2858,7 +2858,7 @@ class SocialComponent extends Component implements CrawlConstants
             if (in_array($hash_id, $_SESSION['seen_media'])) {
                 $_SESSION['seen_media'] = array_diff($_SESSION['seen_media'],
                     [$hash_id]);
-                $parent->model("user")->setUserSession($_SESSION['USER_ID'],
+                $parent->model("user")->setUserSession($user_id,
                     $_SESSION);
             }
         }
@@ -3401,7 +3401,7 @@ EOD;
             if (in_array($hash_id, $_SESSION['seen_media'])) {
                 $_SESSION['seen_media'] = array_diff($_SESSION['seen_media'],
                     [$hash_id]);
-                $parent->model("user")->setUserSession($_SESSION['USER_ID'],
+                $parent->model("user")->setUserSession($user_id,
                     $_SESSION);
             }
         }
@@ -3612,7 +3612,7 @@ EOD;
         $is_static = ($data['CONTROLLER'] == 'static') ? true : false;
         $base_url = htmlentities(B\wikiUrl($data['PAGE_NAME'] , true,
             $data['CONTROLLER'], $group_id));
-        if (isset($_SESSION['USER_ID'])) {
+        if (isset($_SESSION['USER_ID']) && intval($_SESSION['USER_ID']) > 0) {
             $user_id = $_SESSION['USER_ID'];
             $data['ADMIN'] = 1;
         } else {
diff --git a/src/data/public_default.db b/src/data/public_default.db
index df6e086b2..6bdb59c5f 100644
Binary files a/src/data/public_default.db and b/src/data/public_default.db differ
diff --git a/src/executables/ArcTool.php b/src/executables/ArcTool.php
index 8cdc94189..ee83b9250 100755
--- a/src/executables/ArcTool.php
+++ b/src/executables/ArcTool.php
@@ -1282,7 +1282,7 @@ php ArcTool.php shard bundle_name generation
 php ArcTool.php shard double_index_name which_bundle generation
     /* Prints information about the number of words and frequencies of words
        within the generation'th index shard in the index archive bundle
-       or double index bundle (in which case need to say eithe 0 or  1 bbundle)
+       or double index bundle (in which case need to say either 0 or  1 bundle)
      */

 php ArcTool.php show bundle_name start num
diff --git a/src/executables/QueueServer.php b/src/executables/QueueServer.php
index e249ade3b..2c383b466 100755
--- a/src/executables/QueueServer.php
+++ b/src/executables/QueueServer.php
@@ -1262,7 +1262,7 @@ class QueueServer implements CrawlConstants, Join
             $this->index_dirty = false;
             // chmod so apache can also write to these directories
             $this->db->setWorldPermissionsRecursive(
-                C\CRAWL_DIR.'/cache/' . $base_name . $this->crawl_time);
+                C\CRAWL_DIR . '/cache/' . $base_name . $this->crawl_time);
         }
     }
     /**
diff --git a/src/library/IndexDictionary.php b/src/library/IndexDictionary.php
index 5f7bd3c48..103b51403 100644
--- a/src/library/IndexDictionary.php
+++ b/src/library/IndexDictionary.php
@@ -1293,10 +1293,12 @@ class IndexDictionary implements CrawlConstants
         }
         if (!isset($this->fhs[$file_num][$tier]) ||
             $this->fhs[$file_num][$tier] === null) {
-            $file_name = $this->dir_name."/$file_num/".$tier."A.dic";
+            $file_name = $this->dir_name . "/$file_num/" . $tier . "A.dic";
             if (!file_exists($file_name)) { return $false; }
             $this->fhs[$file_num][$tier] = fopen($file_name, "rb");
-            if ($this->fhs[$file_num][$tier] === false) { return $false; }
+            if ($this->fhs[$file_num][$tier] === false) {
+                return $false;
+            }
             $this->file_lens[$file_num][$tier] = filesize($file_name);
         }
         if ($bytes >= $this->file_lens[$file_num][$tier]) {
diff --git a/src/library/Utility.php b/src/library/Utility.php
index 094f95d11..99f5c7666 100755
--- a/src/library/Utility.php
+++ b/src/library/Utility.php
@@ -1511,11 +1511,13 @@ function partitionByHash($table, $field, $num_partition, $instance,
     $callback = null)
 {
     $out_table = [];
-    foreach ($table as $row) {
-        $cell = ($field === null) ? $row : $row[$field];
-        $hash_int = calculatePartition($cell, $num_partition, $callback);
-        if ($hash_int  == $instance) {
-            $out_table[] = $row;
+    if (is_array($table)) {
+        foreach ($table as $row) {
+            $cell = ($field === null) ? $row : $row[$field];
+            $hash_int = calculatePartition($cell, $num_partition, $callback);
+            if ($hash_int  == $instance) {
+                $out_table[] = $row;
+            }
         }
     }
     return $out_table;
@@ -2366,6 +2368,18 @@ function bchexdec($hex)
     }
     return $dec;
 }
+/**
+ * Returns whether an input can be parsed to a positive integer
+ *
+ * @param mixed $input
+ * @return bool whether $input can be parsed to a positive integer.
+ */
+function positiveInt($input)
+{
+    return (is_int($input) && $input > 0) ||
+        (is_string($input) &&
+        preg_match("/^\d+$/", trim($input)) && intval($input) > 0);
+}
 /**
  * Runs various system garbage collection functions and returns
  * number of bytes freed.
diff --git a/src/library/WikiParser.php b/src/library/WikiParser.php
index 37a874202..b58f0013a 100644
--- a/src/library/WikiParser.php
+++ b/src/library/WikiParser.php
@@ -759,7 +759,9 @@ function makeTableCallback($matches)
     $table_cell_attributes = ["align", "colspan", "style", "scope",
         "rowspace", "valign"];
     foreach ($row_data as $item) {
-        crawlTimeoutLog("..Making Wiki Tables..");
+        if (empty($GLOBALS['web_site'])) {
+            crawlTimeoutLog("..Making Wiki Tables..");
+        }
         if ($first) {
             $item = trim(str_replace("\n", " ", $item));
             $item = str_replace("&quot;", "\"", $item);
diff --git a/src/locale/ar/configure.ini b/src/locale/ar/configure.ini
index beec070ce..db2575aa7 100755
--- a/src/locale/ar/configure.ini
+++ b/src/locale/ar/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/bn/configure.ini b/src/locale/bn/configure.ini
index 34eab1c3d..89da9248f 100755
--- a/src/locale/bn/configure.ini
+++ b/src/locale/bn/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/de/configure.ini b/src/locale/de/configure.ini
index fc6451920..52385328e 100755
--- a/src/locale/de/configure.ini
+++ b/src/locale/de/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini
index fca09702d..755f7e9ed 100644
--- a/src/locale/en_US/configure.ini
+++ b/src/locale/en_US/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = "%s Page at %s Group Discussion RSS"
 group_view_wiki_page = "%s Page at %s Group"
 group_view_rss = "%s RSS"
 group_view_groupfeed = "%s Feed"
+group_view_no_path_info = "No Path Info"
 group_view_userfeed = "User: %s"
 group_view_userrss = "User: %s RSS"
 group_view_myfeeds = "My Feeds"
diff --git a/src/locale/es/configure.ini b/src/locale/es/configure.ini
index d251d9580..84943d71b 100755
--- a/src/locale/es/configure.ini
+++ b/src/locale/es/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/fa/configure.ini b/src/locale/fa/configure.ini
index b3650a433..a4b671048 100755
--- a/src/locale/fa/configure.ini
+++ b/src/locale/fa/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/fr_FR/configure.ini b/src/locale/fr_FR/configure.ini
index a1975415a..1e7cca2b3 100755
--- a/src/locale/fr_FR/configure.ini
+++ b/src/locale/fr_FR/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/he/configure.ini b/src/locale/he/configure.ini
index 5459891a2..c009ae727 100755
--- a/src/locale/he/configure.ini
+++ b/src/locale/he/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/hi/configure.ini b/src/locale/hi/configure.ini
index 5c0e197db..b61379af6 100755
--- a/src/locale/hi/configure.ini
+++ b/src/locale/hi/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/in_ID/configure.ini b/src/locale/in_ID/configure.ini
index 96942ecd1..efe75cf71 100755
--- a/src/locale/in_ID/configure.ini
+++ b/src/locale/in_ID/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/it/configure.ini b/src/locale/it/configure.ini
index 61a9d302d..f01332d8e 100755
--- a/src/locale/it/configure.ini
+++ b/src/locale/it/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/ja/configure.ini b/src/locale/ja/configure.ini
index 7e43a013c..b99e96be7 100755
--- a/src/locale/ja/configure.ini
+++ b/src/locale/ja/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/kn/configure.ini b/src/locale/kn/configure.ini
index 47b4d5c7a..8334d532d 100755
--- a/src/locale/kn/configure.ini
+++ b/src/locale/kn/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/ko/configure.ini b/src/locale/ko/configure.ini
index f6769ac85..84406f8e2 100755
--- a/src/locale/ko/configure.ini
+++ b/src/locale/ko/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/nl/configure.ini b/src/locale/nl/configure.ini
index 0027f66df..91b47451d 100644
--- a/src/locale/nl/configure.ini
+++ b/src/locale/nl/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = "mijn Feeds"
diff --git a/src/locale/pl/configure.ini b/src/locale/pl/configure.ini
index 974d61d5c..c0368bcdf 100755
--- a/src/locale/pl/configure.ini
+++ b/src/locale/pl/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/pt/configure.ini b/src/locale/pt/configure.ini
index 60ce6e3e2..1b1189cd2 100755
--- a/src/locale/pt/configure.ini
+++ b/src/locale/pt/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/ru/configure.ini b/src/locale/ru/configure.ini
index 0c12dd991..a636ca23c 100755
--- a/src/locale/ru/configure.ini
+++ b/src/locale/ru/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/te/configure.ini b/src/locale/te/configure.ini
index 18de04234..45ebe0ed2 100644
--- a/src/locale/te/configure.ini
+++ b/src/locale/te/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/th/configure.ini b/src/locale/th/configure.ini
index a5b6912a1..71638f90e 100755
--- a/src/locale/th/configure.ini
+++ b/src/locale/th/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/tr/configure.ini b/src/locale/tr/configure.ini
index df98e6080..344e33635 100755
--- a/src/locale/tr/configure.ini
+++ b/src/locale/tr/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/vi_VN/configure.ini b/src/locale/vi_VN/configure.ini
index fcf1c0b4c..86ccb1167 100755
--- a/src/locale/vi_VN/configure.ini
+++ b/src/locale/vi_VN/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/locale/zh_CN/configure.ini b/src/locale/zh_CN/configure.ini
index 62cc03e5d..83205761e 100755
--- a/src/locale/zh_CN/configure.ini
+++ b/src/locale/zh_CN/configure.ini
@@ -829,6 +829,7 @@ group_view_page_thread_rss = ""
 group_view_wiki_page = ""
 group_view_rss = ""
 group_view_groupfeed = ""
+group_view_no_path_info = ""
 group_view_userfeed = ""
 group_view_userrss = ""
 group_view_myfeeds = ""
diff --git a/src/models/CrawlModel.php b/src/models/CrawlModel.php
index ce416f136..0fa844ed2 100755
--- a/src/models/CrawlModel.php
+++ b/src/models/CrawlModel.php
@@ -1036,7 +1036,7 @@ EOT;
             });
             $num_sites = count($sites);
             // use high 3 bytes for integer weight, 1 byte to remember depth
-            $common_start_weight = floor(((1 << 24) - 1) / min($num_sites, 1));
+            $common_start_weight = floor(((1 << 24) - 1) / max($num_sites, 1));
             foreach ($sites as $site) {
                 $site_parts = preg_split("/\s+/", $site);
                 if (strlen($site_parts[0]) > 0) {
diff --git a/src/models/ProfileModel.php b/src/models/ProfileModel.php
index 2db0b085e..54af8c87a 100755
--- a/src/models/ProfileModel.php
+++ b/src/models/ProfileModel.php
@@ -832,7 +832,7 @@ EOT;
             return false;
         }
         $out = substr($config,  0, $start_machine_section);
-        $out .= "/*+++ The next block of code is machine edited, change at \n".
+        $out .= "/*+++ The next block of code is machine edited, change at\n".
             "your own risk, please use configure web page instead +++*/\n";
         $out .= "nsdefine('WORK_DIRECTORY', $dir_value);\n";
         $out .= substr($config, $end_machine_section);
diff --git a/src/views/GroupView.php b/src/views/GroupView.php
index c86366d14..e99631223 100644
--- a/src/views/GroupView.php
+++ b/src/views/GroupView.php
@@ -146,19 +146,24 @@ class GroupView extends View implements CrawlConstants
             $this->element('groupfeed')->renderPath($data, $paths,
                  $groupwiki_url, $group_base_query, $data['SUBTITLE']);
         } else if (isset($data['JUST_USER_ID'])) {
-            $viewed_user_name = $data['PAGES'][0]["USER_NAME"];
-            $userfeed_url = htmlentities(B\feedsUrl("user",
-                $data['JUST_USER_ID'], true, $data['CONTROLLER'])).
-                $token_string;
-            $group_base_all = B\feedsUrl("", "", true,
-                $data['CONTROLLER']) . $token_string;
-            $paths = [
-                $userfeed_url => tl("group_view_userfeed",
-                    $viewed_user_name),
-                $userfeed_url."&amp;f=rss" =>
-                    tl("group_view_userrss", $viewed_user_name)];
-            $this->element('groupfeed')->renderPath($data, $paths,
-                 $group_base_all, $userfeed_url, $viewed_user_name, "user");
+            if (empty($data['PAGES'][0]["USER_NAME"])) {
+                e(tl("group_view_no_path_info"));
+            } else {
+                $viewed_user_name = $data['PAGES'][0]["USER_NAME"];
+                $userfeed_url = htmlentities(B\feedsUrl("user",
+                    $data['JUST_USER_ID'], true, $data['CONTROLLER'])).
+                    $token_string;
+                $group_base_all = B\feedsUrl("", "", true,
+                    $data['CONTROLLER']) . $token_string;
+                $paths = [
+                    $userfeed_url => tl("group_view_userfeed",
+                        $viewed_user_name),
+                    $userfeed_url."&amp;f=rss" =>
+                        tl("group_view_userrss", $viewed_user_name)];
+                $this->element('groupfeed')->renderPath($data, $paths,
+                     $group_base_all, $userfeed_url, $viewed_user_name,
+                     "user");
+            }
         } else {
             $paths = [];
             $this->element('groupfeed')->renderPath($data, $paths, "",
ViewGit