Media playback is unsupported on your device Media caption BBC Panorama conducted secret filming in Bangladesh

It's the middle of the night and I am lying on the floor of a van in the sweltering back streets of Dhaka, Bangladesh.

I'm outside a factory making clothes for a western supermarket.

I can see dozens of workers inside. They've been in there since 07:00.

We've been told this factory - Ha Meem Sportswear - works incredible hours; we're hiding in the shadows to get the proof.

There's a guard sitting in front of the main gate. He hasn't spotted us.

He's about to do something shockingly dangerous.

At 01.15 - with workers still busy inside - he locks the main factory gate and wanders away.

Image caption Four million people work in Bangladesh's garment industry

This place had a fire a few weeks ago and they're commonplace in the industry. If anything goes wrong tonight, the workers are trapped inside.

The shift finally ends at 02.30. That's a nineteen and a half hour day.

One worker agrees to talk. He earned about £2 for the shift and he's exhausted. He has to be back at work again for 07:00.

He says: "My feelings are bad and my health is too. In the last two weeks, approximately, it has been like this for eight nights."

Two days later, I return to Ha Meem Sportswear. I am going undercover as a buyer from a fake British clothing company.

I want to hear what the factory owners say about shifts.

We are shown around. The factory is old and cramped. One woman is working under a table.

The managers show us the order they're working on: 150,000 pairs of jeans and dungarees for the discount supermarket Lidl.

The factory owners, they keep two different books.....These retailers' so-called audits really don't work Kalpona Akter, Bangladesh Center for Worker Solidarity

I ask about working hours and I'm assured the factory closes at 17:30.

I ask about whether gates are ever locked: they say they are always open.

It's clear the buyer is told what he wants to hear.

They even provided timesheets for the night I watched the factory. They say the shift ended at 17:30.

The paperwork looks convincing. If I hadn't seen it myself, I would never know that workers were being forced to work such long days.

Ha Meem Sportswear is far from the only clothing manufacturer pulling this trick.

Kalpona Akter, from the Bangladesh Center for Worker Solidarity, says many factories hide the truth about working hours from Western retailers.

"The factory owners, they keep two different books. So one they show to the buyers, the other they show to the worker. These retailers' so-called audits really don't work."

'Concerning' findings

Codes of conduct demanded by Western retailers to improve conditions are worthless if double books mean there's no way of monitoring worker hours.

Lidl said our findings were "concerning" and showed how important it was to improve conditions in Bangladesh.

"Change, however, takes time and constitutes not only a challenge for Lidl but for all active companies in the retail industry."

The supermarket said it had invested more than £6m to improve the living and working conditions in Bangladesh.

Ha Meem Sportswear denied that workers were forced to work 19-hour shifts or that they were locked inside. It said there was a second gate at the factory that was open and that there hadn't been a fire, just "some smoke".

The company said our allegations about timesheets were "false and baseless" and that it worked legally and "does not deprive workers of their rights".

I went to other factories where British retailers face criticism.

Image caption Richard Bilton visited various factories in Bangladesh.

Tazreen Fashions is on the outskirts of Dhaka.

It's a burnt-out shell. The metal bars on the windows are still twisted and warped - melted by the fire that swept through the factory last November killing more than 100 workers.

I met Mohammad Abdul Jabbar who lost his wife and sister-in-law. He couldn't tell me his story without crying: "The day she passed away I talked to her at lunch. I had a long chat with her. But after a couple of hours when I came back I saw she is no more. I was watching the fire blazing with my own eyes, but there was no way to save her."

But a UK company is being accused of not paying compensation to the families of the dead.

We were shown photos of boxes of Edinburgh Woollen Mill clothes taken inside Tazreen Fashion following the fire last November.

The company says that rejected clothes and sealed samples were stored at Tazreen without its knowledge or prior approval.

So we dug deeper. We were handed documents which appear to show that Edinburgh Woollen Mill clothes were manufactured at Tazreen.

They include specific product codes and have details of Edinburgh Woollen Mill T-shirts and polo shirts indicating they were being made and inspected inside the factory.

The product codes on the documents match the product codes for clothing currently on sale in the company's shops.

We also spoke to former Tazreen workers who said they had been working on Edinburgh Woollen Mill products for months before the fire.

But the company strongly objected to those claims. It says the paperwork was "inaccurate or fabricated" and that documents and clothes that had been stored at the factory were scattered around after the fire to imply that Edinburgh Woollen Mill products were made there.

Edinburgh Woollen Mill still denies its clothes were made at the factory, but now says it has offered financial assistance.

In Bangladesh I saw an industry that was transforming the nation - providing money and jobs for millions.

The majority of factories are safe and modern - but hundreds of thousands still work in dangerous and illegal conditions to provide clothing for Western High Streets.

You can watch Panorama - Dying for a Bargain on BBC1 at 20:30 on Monday 23 September.