Although it is a very good practice set error_reporting to E_ALL during development phase and trying to eliminate all notices, personally I wouldn't worry about these messages. It just won't find the elements on the specified indices during the loop. In any case, if you insist on eliminating the notices, you can change
{if $TablesLinked[i]}
to
{if isset($TablesLinked[i]) && $TablesLinked[i]}