//search each name of list linksto into list reflink
foreach ($pages as $v) {
if (!in_array($v, $refs)) {
if (!in_array($v, $array_refs_linked)) {
$orphaned[] = $v;
}
}
foreach ($orphaned as $orphaned_show) {
// get visibility status and title
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' AND reflink="'.Database::escape_string($orphaned_show).'" GROUP BY reflink';