There's no such thing as a generic LDR. They're available in a wide range of resistances. This one varies from 30k\$\Omega\$ to 5M\$\Omega\$, while this one varies between 11k\$\Omega\$ and 150k\$\Omega\$. They will give you a completely different output range, which the software may or not may detect properly.
The first one will give a voltage between 3mV and 0.5V. If you have an LDR like this the output voltage may be too low.
The second one, on the other hand, will give you a voltage between 0.1V and 1.15V, which is already a bit better. A 4.7k\$\Omega\$ resistor will raise this to 1.5V.
The transistor amplifies the current. You have a small current from base to emitter, and the transistor creates a larger current from collector to emitter. The amplification factor can be found as \$H_{FE}\$ in the datasheet, and for small signal transistors is often around 100. So 1 mA base current will result in 101 mA emitter current (that's 100 mA collector current + the 1 mA base current).
I'd like to repeat that this is not the best circuit. There should at least be a small resistor in series with the LED for regulation. If you replace the transistor with another one of the same type you suddenly may have two or three times the LED current. That's because the collector current in your circuit is only determined by base current and \$H_{FE}\$, there's not else limiting it. But for a BC337 \$H_{FE}\$ can vary between 100 and 600! So you can have a 1:6 variation in LED current. That's not good. Do it this way:

(By the way, drawn in 2 minutes with CircuitLab)
If you leave out Q1 you only have the current through R2 and Q2, and that increases with the light level. So you can't use that directly for the LED, for that you want the current to decrease, and also the current will be too low.
The voltage across R2 is constant: 3 V - 0.7 V = 2.3 V, so it's current will be constant too. The increase/decrease inversion is done by phototransistor Q2: if its current increases the base current to Q1 has to decrease, since the total is constant.
A PNP transistor works like an NPN, but with the currents reversed: a low current from emitter to base will cause a larger current from emitter to collector.
If we would replace Q1 with a PNP then the circuit turns upside down:

This circuit does exactly what the other does: if it's dark there won't be any current through Q2, and R2 will cause base current in Q1. The current flows from the emitter of Q1 through its base to R2 and ground. That base current will cause a higher collector current which will light the LED. R1 will limit the current to a safe value. If there falls light on Q2 it will cause a higher current through R2, but that current was constant at 2.3 mA ((3 V - 0.7 V) / 1 kΩ), so the base current will decrease, and so will the LED current.
Best Answer
This suggests you didn't properly connect it. I'll presume you have your LDR connected to ground and the series resistor that forms the divider to Vcc. If the value is zero, that would mean that the LDR's resistance is less than 1/1000th of the series resistor. That's possible. But then the 1023 isn't possible, because that would mean that the LDR's resistance is larger than 1000 times the series resistor, and LDR's don't have a > 1000 000 range between light and dark resistance.
If you have a multimeter measure the LDR's dark and light resistance, and pick a series resistance in between those values. The series resistance goes between Vcc and tha ADC input, the LDR between the ADC input and ground.
edit
You say the pin was unconnected, and still you got this input variations. If you plot them out you get a perfect sine:
It's not impossible that the ADC picked this up from the noise the mains radiate. The sine is much slower than the mains frequency, but that's an artifact you can get with subsampling.