Change this to $avatarLastAuthor = $topic->getLastPostAuthor()->getAvatarImage('img-rounded', 48);
put at top of the file
and replace that string with just $avtarLastAuthor.

Again the goal is to shorten the length of variables used inside code.