A court in the United Arab Emirates has handed life sentences to 43 Emiratis for "terrorist" links in a mass trial heavily criticised by rights groups.