[XB] Referer Log

[XB] Referer Log [Paid] 1.0.2

No permission to buy ($15.00)

Painbaker

Well-known member
Licensed customer
Painbaker submitted a new resource:

[XB] Referer Log - Track where visitors come from.

This add-on records the referral source, helping you analyze traffic origins.

Useful for administrators who want to understand how users discover the forum, detect unusual traffic, and evaluate the effectiveness of external, links promotions, or integrations - without collecting unnecessary browsing data.

Logged data​

  • 🌐 Referer (source URL or domain)
  • 🔗 Visited URL (optional)
  • 🕒 First visit date
  • 🔄 Last activity update
  • 🔢...

Read more about this resource...
 
We're receiving the following error:

Code:
    ArgumentCountError: Template admin:pb_rl_referer_log_list error: Too few arguments to function XF\Template\Templater::fnLinkType(), 3 passed in /home/xxxxxxx/domains/xxxxxxx/public_html/src/XF/Template/Templater.php on line 1219 and at least 4 expected src/XF/Template/Templater.php:3315

    Generated by: thomas 26 Dec 2025 at 12:19

Stack trace

#0 src/XF/Template/Templater.php(1219): XF\Template\Templater->fnLinkType(Object(SV\StandardLib\XF\Template\Templater), false, 'logs/referer/cl...')
#1 internal_data/code_cache/templates/l1/s0/admin/pb_rl_referer_log_list.php(16): XF\Template\Templater->func('link_type', Array, false)
#2 src/XF/Template/Templater.php(1799): XF\Template\Templater->{closure:internal_data/code_cache/templates/l1/s0/admin/pb_rl_referer_log_list.php:4}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#3 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('pb_rl_referer_l...', Array)
#4 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#5 src/XF/Mvc/Dispatcher.php(471): XF\Mvc\Renderer\Html->renderView('PB\\RefererLog:R...', 'admin:pb_rl_ref...', Array)
#6 src/XF/Mvc/Dispatcher.php(453): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#7 src/XF/Mvc/Dispatcher.php(412): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(66): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#9 src/XF/App.php(2824): XF\Mvc\Dispatcher->run()
#10 src/XF.php(806): XF\App->run()
#11 admin.php(15): XF::runApp('XF\\Admin\\App')
#12 {main}

Request state

array(4) {
  ["url"] => string(24) "/admin.php?logs/referer/"
  ["referrer"] => string(46) "https://xxxxxxx/admin.php?logs/server-errors/"
  ["_GET"] => array(1) {
    ["logs/referer/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
 
We're receiving the following error:

Code:
    ArgumentCountError: Template admin:pb_rl_referer_log_list error: Too few arguments to function XF\Template\Templater::fnLinkType(), 3 passed in /home/xxxxxxx/domains/xxxxxxx/public_html/src/XF/Template/Templater.php on line 1219 and at least 4 expected src/XF/Template/Templater.php:3315

    Generated by: thomas 26 Dec 2025 at 12:19

Stack trace

#0 src/XF/Template/Templater.php(1219): XF\Template\Templater->fnLinkType(Object(SV\StandardLib\XF\Template\Templater), false, 'logs/referer/cl...')
#1 internal_data/code_cache/templates/l1/s0/admin/pb_rl_referer_log_list.php(16): XF\Template\Templater->func('link_type', Array, false)
#2 src/XF/Template/Templater.php(1799): XF\Template\Templater->{closure:internal_data/code_cache/templates/l1/s0/admin/pb_rl_referer_log_list.php:4}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#3 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('pb_rl_referer_l...', Array)
#4 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#5 src/XF/Mvc/Dispatcher.php(471): XF\Mvc\Renderer\Html->renderView('PB\\RefererLog:R...', 'admin:pb_rl_ref...', Array)
#6 src/XF/Mvc/Dispatcher.php(453): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#7 src/XF/Mvc/Dispatcher.php(412): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(66): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#9 src/XF/App.php(2824): XF\Mvc\Dispatcher->run()
#10 src/XF.php(806): XF\App->run()
#11 admin.php(15): XF::runApp('XF\\Admin\\App')
#12 {main}

Request state

array(4) {
  ["url"] => string(24) "/admin.php?logs/referer/"
  ["referrer"] => string(46) "https://xxxxxxx/admin.php?logs/server-errors/"
  ["_GET"] => array(1) {
    ["logs/referer/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
Should be fixed in last patch
 
Six pages of this new error:

Code:
    XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xC0\xA7\xC0\xA2%2...' for column `xxx_xf`.`xf_pb_rl_referer_log`.`referer` at row 1 src/XF/Db/AbstractStatement.php:225

    Generated by: Unknown account 18 Sep 2026 at 15:05

Stack trace

INSERT  INTO `xf_pb_rl_referer_log` (`user_id`, `ip`, `url`, `url_hash`, `referer`, `referer_hash`, `count`, `log_date`, `last_update_date`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE last_update_date = VALUES(last_update_date), count = LEAST(VALUES(count) + 1, 4294967295)
------------

#0 src/XF/Db/Mysqli/Statement.php(207): XF\Db\AbstractStatement->getException('MySQL query err...', 1366, '22007')
#1 src/XF/Db/Mysqli/Statement.php(83): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1366, '22007')
#2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(219): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/addons/PB/RefererLog/Service/RefererLogger.php(134): XF\Db\AbstractAdapter->insert('xf_pb_rl_refere...', Array, false, 'last_update_dat...')
#5 src/addons/PB/RefererLog/Listener.php(27): PB\RefererLog\Service\RefererLogger->log()
#6 src/XF.php(697): PB\RefererLog\Listener::{closure:PB\RefererLog\Listener::appPubStartEnd():24}()
#7 [internal function]: XF::triggerRunOnce()
#8 {main}

Request state

array(4) {
  ["url"] => string(80) "/threads/something.12345678/"
  ["referrer"] => NULL
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

AI suggested the following changes in RefererLogger.php:
  • Reject a referrer that isn't valid UTF-8.
  • Reject raw control characters (NUL, CR, LF, etc.) in the Referer header. Percent-encoded values such as %0A are left alone.
  • Verify that parse_url() actually produced a valid, non-empty string hostname before passing it to preg_replace(), strtolower() and the domain-ignore logic.
  • Replace substr($referrer, 0, 1000) with mb_strcut(...). This retains the original 1,000-byte limit but cannot chop a Japanese or other multibyte UTF-8 character in half. The original byte-based truncation is at line 126.
  • Validate the request URI too. This is important: getRequestUri() is also ultimately client-controlled, and the original code writes it directly into url. If a bot sends malformed UTF-8 there, you could otherwise get essentially the same MySQL 1366 error for the url column.
  • Malformed input was deliberately not "repaired." Invalid referrers are discarded; invalid request URIs are replaced with an empty value. That keeps garbage out of the statistics rather than manufacturing a valid-looking URL.
 
Painbaker updated [XB] Referer Log with a new update entry:

1.0.2

✨ New Features​

  • Added a Top Referers statistics block.
  • Added a Watched Domains tab to the log view.
  • Added quick actions to add a referer domain to the blacklist, with an option to also ignore the main domain when the referer uses a subdomain.
  • Added batch deletion support to the ACP log page.
  • Added options to delete records with the same referer, IP address, or user from...

Read the rest of this update entry...
 
Six pages of this new error:

Code:
    XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xC0\xA7\xC0\xA2%2...' for column `xxx_xf`.`xf_pb_rl_referer_log`.`referer` at row 1 src/XF/Db/AbstractStatement.php:225

    Generated by: Unknown account 18 Sep 2026 at 15:05

Stack trace

INSERT  INTO `xf_pb_rl_referer_log` (`user_id`, `ip`, `url`, `url_hash`, `referer`, `referer_hash`, `count`, `log_date`, `last_update_date`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE last_update_date = VALUES(last_update_date), count = LEAST(VALUES(count) + 1, 4294967295)
------------

#0 src/XF/Db/Mysqli/Statement.php(207): XF\Db\AbstractStatement->getException('MySQL query err...', 1366, '22007')
#1 src/XF/Db/Mysqli/Statement.php(83): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1366, '22007')
#2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(219): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/addons/PB/RefererLog/Service/RefererLogger.php(134): XF\Db\AbstractAdapter->insert('xf_pb_rl_refere...', Array, false, 'last_update_dat...')
#5 src/addons/PB/RefererLog/Listener.php(27): PB\RefererLog\Service\RefererLogger->log()
#6 src/XF.php(697): PB\RefererLog\Listener::{closure:PB\RefererLog\Listener::appPubStartEnd():24}()
#7 [internal function]: XF::triggerRunOnce()
#8 {main}

Request state

array(4) {
  ["url"] => string(80) "/threads/something.12345678/"
  ["referrer"] => NULL
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

AI suggested the following changes in RefererLogger.php:
  • Reject a referrer that isn't valid UTF-8.
  • Reject raw control characters (NUL, CR, LF, etc.) in the Referer header. Percent-encoded values such as %0A are left alone.
  • Verify that parse_url() actually produced a valid, non-empty string hostname before passing it to preg_replace(), strtolower() and the domain-ignore logic.
  • Replace substr($referrer, 0, 1000) with mb_strcut(...). This retains the original 1,000-byte limit but cannot chop a Japanese or other multibyte UTF-8 character in half. The original byte-based truncation is at line 126.
  • Validate the request URI too. This is important: getRequestUri() is also ultimately client-controlled, and the original code writes it directly into url. If a bot sends malformed UTF-8 there, you could otherwise get essentially the same MySQL 1366 error for the url column.
  • Malformed input was deliberately not "repaired." Invalid referrers are discarded; invalid request URIs are replaced with an empty value. That keeps garbage out of the statistics rather than manufacturing a valid-looking URL.
Should be fixed
 
Back
Top Bottom