Added getTotalLinks function