[QA] Scanpath DRY

This pull request moves the duplicated `scanpath` function from tools/*.php into tools/lang.base.php.